Created
September 27, 2013 15:43
-
-
Save ha-yi/6730675 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (isset($_POST['submit'])) { | |
$Fname = $_POST['fname']; | |
$Lname = $_POST['lname']; | |
$fp = fopen("input.txt","a");// Open data.txt for writing | |
if(!$fp) { | |
echo 'Error, the file could not be opened or there was an error creating it.'; | |
exit; | |
} | |
if(@fwrite($fp, $Fname.'|'.$Lname."\n")){ | |
echo 'Record Added'; | |
}else{ | |
echo 'Failed'; | |
} | |
fclose($fp); | |
} | |
?> | |
<html> | |
<body> | |
<form name="input" method="post" action="<?php echo $_SERVER['SCRIPT_NAME']?>"> | |
<p><label for="firstname">First Name: </label> | |
<input type="text" name="fname" id="fname" /></p> | |
<p><label for="firstname">Last Name: </label> | |
<input type="text" name="lname" id="lname" /> | |
<p><input type="reset" name="reset" value="reset" /> | |
<input type="submit" name="submit" value="submit" /></p> | |
</form> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment