Well, I put in the HTML and moved the end body tag, tried it on two servers, PHP3 and PHP4, no joy.
So I altered it, dunno if its working, it gave me a form, I filled it in, no errors, but no message to say it worked, if its meant to, I don't have the time to go through and do all that, but it gives you a form now.
Btw, do the php coding, then the HTML. Also, theres no need to go ?> and then <?php, just keep the code going.
Have a nice day.
<?php
//complex mailer php form
function mail_header()
{ }
function mail_footer()
{ }
function error_message($msg)
{
mail_header();
echo "<script>alert(\"Error: $msg\");history.go(-1)</script>";
mail_footer();
exit;
}
function user_message($msg) {
mail_header();
echo "<script>alert(\"$msg\");history.go(-1)</script>";
mail_footer();
exit;
}
function mail_form()
{
global $PHP_SELF;
}
function send_mail()
{
global $name, $email, $message;
global $mail_body, $mail_subject;
$mail_parts["mail_to"] = $mail_to;
$mail_parts["mail_from"] = $email;
$mail_parts["mail_subject"] = $mail_subject;
$mail_parts["mail_body"] = $message;
}
function my_mail()
{
$mail_parts["mail_to"] = $mail_to;
$mail_parts["mail_from"] = $email;
$mail_parts["mail_subject"] = $mail_subject;
$mail_parts["mail_body"] = $message;
if(empty($name)) error_message("Empty name field!");
if(empty($email)) error_message("Empty email field!");
if(empty($message)) error_message("Empty message field!");
return mail($name,$email,$message);
}
switch ($action)
{
case "send_mail":
mail_header();
send_mail();
mail_footer();
break;
case "mail_form":
mail_header();
send_mail();
mail_footer();
break;
default;
mail_header();
send_mail();
mail_footer();
break;
}
?>
<head>
<title>
</title>
</head>
<body>
<table width="75%" border="0" height="271">
<tr>
<td>
<form name="messageForm" enctype="multipart/form-data"action="<?php echo $PHP_SELF ?>" method="post">
<p></p>
<p>
<input type="hidden" name="subject" value="Mount Analog Mailing List">
Got a thought? Log it. </p>
<p>Name:
<input type="text" name="name">
</p>
<p> E-mail:
<input type="text" name="email">
</p>
<p>
<textarea name="message" cols="22" rows="10"></textarea>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
<br>
<br>
<input type="reset" name="reset" value="Reset">
</p>
</form>
</td>
</tr>
</table>
</body>