i copied a code for form-to-mail. It works, i get the information to my mail box,
but when the user clicks the submit btn the browser opens the php file (just an empty page shows).
why does it open the file and how can i change this behavior?
here's my php file:
Code: Select all
<!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>Untitled Document</title>
</head>
<body>
<script language="php">
$email = $HTTP_POST_VARS[email];
$mailto = "mymail@gmail.com";
$mailsubj = "Form submission";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; }
if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); }
</script>
</body>
</html>
Here's the html:
Code: Select all
<fieldset id="registerform">
<legend>Get our newsletter</legend>
<form method="post" action="register.php">
Email<br />
<input type="text" name="email" id="formemailbox">
<input type="submit" value="ok">
</form>
</fieldset>