Jump to content

Php form to text file


adamriley

Recommended Posts

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")  
?>

Link to comment
https://forums.phpfreaks.com/topic/187297-php-form-to-text-file/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.