Sunday, 8 September 2013

Issue with PHP for saving data

Issue with PHP for saving data

my task is to save form data to text file.but,the php isnt getting
executed.. even after hitting the submit button, the text file is empty..
please let me know the flaws myhtml
<form id="form" name="form" method="post" action="Input2.php">
<label>Choose my Map set :
</label>
<select name="Mapset">
<option value="Global network">Global Network</option>
</select> <br>
<br>
<label>Tiff code:
</label>
<select name="Tiff">
<option value="MX">MX</option>
</select> <br> <br>
<label>Physical size :
</label>
<input type="text" name="size" size="10"><br>
<label>time:
</label>
<input type="text" name="time" size="10"><br>
<div style="text-align: center"><br>
<input type="submit" name="submit" id="submit" value="Next" class="submit">
<div class="spacer"></div>
</form>
My PHP:
$file = "input.txt";
$fp = fopen($file, "a") or die("Couldn't open $file for writing!");
fwrite($fp, $data) or die("Couldn't write values to file!");
fclose($fp);
echo "Saved to $file successfully!";
}
header("location:NetOptInput3.html");
?>

No comments:

Post a Comment