I am having trouble getting PHP to pick up the data from the form. The email is sent, but it says Name= and Age= giving no values.
Thx
http://www.businessmeninchrist.com/T...Javascript.php
Code:
<html><HEAD><TITLE>Waynes PHP Mail Testing with Javascript checking</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="stylesheet.css" rel=stylesheet>
<script>
function checkBMICform() {
nameOK = true;
ageOK = true;
saveNameValue = document.BMICForm.name.value;
saveAgeValue = document.BMICForm.age.value;
if (saveNameValue == "") {
/* alert("You must give us your name") */
nameOK = false;
}
if (saveAgeValue == "") {
/* alert("You must give us your age") */
ageOK = false;
}
if (nameOK && ageOK) {
<?php
import_request_variables("gP", "name_");
import_request_variables("gP", "age_");
$to = 'eugenebarleycorn@netscape.net';
$subject = 'PHP Form Test';
$message = "Name = " . $_POST['name'] . "\nAge = " . $_POST['age'];
$message = wordwrap($message, 70);
$headers = 'From: wmckinstry@businessmeninchrist.com' . "\r\n" .
'Reply-To: wmckinstry@businessmeninchrist.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
alert("Your information has been sent.");
document.BMICForm.name.value="";
document.BMICForm.age.value="";
}
else {
alert("You must enter all values")
}
}
</script>
</HEAD>
<body>
<h1> This is test of PHP forms </h1>
<form name="BMICForm" method="post" onsubmit="return checkBMICform()">
<p>Your name: <input type="text" name="name" id="name"/></p>
<p>Your age: <input type="text" name="age" id="age"/></p>
<p><input type="button" onclick="checkBMICform()" value="Send"/></p>
<p><input type="reset" /></p>
</form>
</body>
</html>
Bookmarks