Hi All,
I am trying to write the name="fname" & name="age" to a .txt file, but it's not writing those two things to the file.
Thanks,
T
I am trying to write the name="fname" & name="age" to a .txt file, but it's not writing those two things to the file.
Code:
<?php echo '<?xml version="1.0" encoding="IUTF-8"?>'; ?>
<!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 name="generator" content="HTML Tidy for Linux (vers 25 March 2009), see www.w3.org" />
<link rel="stylesheet" type="text/css" href="css/styles.css" />
<script type="text/javascript" src="js/catalog.js"></script>
<title>Catalog</title>
</head>
<body>
<form id="frm1" name="myForm" onsubmit="return (validateForm() && checkRadios())" action="thankyou.php"
method="post">First name: <input type="text" name="fname" /> Age: <input type="text" name="age" /> <input
type="submit" name="submit" value="Submit" /> <input type="button" onclick="formReset()" value="Reset form" />
<br />
</body>
</html>
<?php
$iName = $_POST['fname'];
$pAge = $_POST['age'];
$data = "$iName | $pAge\n";
$fh = fopen("db\orders.txt", "a");
fwrite($fh, $data);
fclose($fh);
?>
Code:
<?php
$iName = $_POST['fname'];
$iAge = $_POST['age'];
$data = "$iName | $iAge\n";
$fh = fopen("db\orders.txt", "a");
fwrite($fh, $data);
fclose($fh);
T
Comment