I am trying to get a simple form working with a simple php document with validation, but at the validation stage, it always comes up with no email specified when in the html document there is, here is the code for the html document:
<form action="send_mail.php" method="post" enctype="text/plain"> Name:<br /> <input type="text" name="real_name" value="" /><br /> E-mail:<br /> <input type="text" name="email_address" value="" /><br /> Phone:<br /> <input type="text" name="telephone" value="" /><br /> Message:<br /> <textarea name="messages" cols="50" rows="10"></textarea> <br /><br /> <input type="submit" value="Send"> </form>
and here is the PHP document:
<?php
$to = "info@.co.uk" ;
$from = $_REQUEST['email_address'] ;
$name = $_REQUEST['real_name'] ;
$headers = "From: $from";
$subject = "Web Contact Data";
$fields = array();
$fields{"real_name"} = "real_name";
$fields{"email_address"} = "email_address";
$fields{"telephone"} = "telephone";
$fields{"messages"} = "messages";
$body = "We have received the following information:\n\n"; foreach($fields as $a => $B)/>{ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
if($from == '') {print "You have not entered an email, please go back and try again";}
else {
if($name == '') {print "You have not entered a name, please go back and try again";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: http://" );}
else
{print "We encountered an error sending your mail, please notify "; }
}
}
?>
Please help, I am new to PHP,
Thanks

New Topic/Question
Reply



MultiQuote




|