adamriley Posted January 5, 2010 Share Posted January 5, 2010 Hi couuld someone say why its not working It writes "|" to the text file "Enter.txt" code for "form.html" --------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Input Form</title> </head> <body> <form name="Form1" method="POST" action="forma.php" enctype="text/plain" id="Form1" name="inputform"> <input type="submit" id="Button1" name="Button1" value="Submit" style="position:absolute;left:249px;top:83px;width:75px;height:25px;font-family:Arial;font-size:13px;z-index:2"> <input type="text" id="Editbox1" style="position:absolute;left:63px;top:21px;width:499px;color:#FF0000;font-family:Courier New;font-size:27px;z-index:3" name="Adam" value=""> </form> </body> </html> ---------- code for "forma.php" <?php if ($_SERVER['REQUEST_METHOD'] == 'POST') { $field1 = $_POST['Adam'] ; $f=fopen("Enter.txt","a"); fwrite($f,"$field1|\r\n"); fclose($f); } header("Location: form.html") ?> Quote Link to comment https://forums.phpfreaks.com/topic/187297-php-form-to-text-file/ Share on other sites More sharing options...
PFMaBiSmAd Posted January 5, 2010 Share Posted January 5, 2010 enctype="text/plain" The above is an invalid enctype for a form. Remove that from your form tag. Quote Link to comment https://forums.phpfreaks.com/topic/187297-php-form-to-text-file/#findComment-989077 Share on other sites More sharing options...
adamriley Posted January 5, 2010 Author Share Posted January 5, 2010 Thanks now solved Quote Link to comment https://forums.phpfreaks.com/topic/187297-php-form-to-text-file/#findComment-989079 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.