PDA

View Full Version : PHP problem....


Htmllearner5
02-01-2007, 09:37 PM
I used:

<html>
<head>
</head>
<body>
<form action="andrestats.php" method="post">
<input type="text" name="subandrestatsta" />
<input type="submit" value="Submit" />
</form>
</body>
</html>

to submit the data. And this:
<?php
$stats = $_POST['andrestatsta'];
$myFile = "andre.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "$stats";
fwrite($fh, $stats);
fclose($fh);
?>

To print the data to the text file...it doesnt work!

agrestik
02-01-2007, 09:59 PM
Hi htmllearner,

This looks like an easy fix,

<input type="text" name="subandrestatsta" />

$stats = $_POST['andrestatsta'];