-The code that is below is just a basic test form and what i would like to be able to do is, when the "Send button" is clicked all the information is sent to an email address to be read, but where do i put the email address in and what code have i got missing for it.
I would be very greatful for you help, thanks.
<body>
<form>
First Name: <input type="text" name="firstname" />
Last Name: <input type="text" name="lastname" />
<p>
<input type="radio" name="sex" value="Male" /> Male
<input type="radio" name="sex" value="Female" /> Female
</p>
<input type="checkbox" name="Transport" value="Car" /> Car
<input type="checkbox" name="Transport" value="Bus" /> Bus
<input type="checkbox" name="Transport" value="Train" /> Train
<input type="checkbox" name="Transport" value="Bike" /> Bike
<p>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</p>
</form>
</body>
</html>You can not do this in html. First you also need to declare the form action and method. Action should be to call itself again, or to call another page. Method should always be "post" You will need to use php to read the input from the form into a recognised format for the php mail() function. search for php manual in google, then search the mail function. This will only work correctly if your hosting site have the sendmail functionality, or if you can obtain a secure login to an appropriate smtp mail server.
Hi you need to use PHP. Where your form main tag is alter it as follows.
<form> becomes <form method="post" action="email_send.php">
On the email_send.php page you would have the following.
<?php
$subject = "Contact Recieved";
$message_body = $_POST['name'];
$headers =
"From: $email" . "\r\n" .
"Reply-To: $email" . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$mail_response = mail("YOUR EMAIL HERE" , $subject, $message_body, $headers);
header("Refresh: 0; url = PAGE TO RETURN TO GOES HERE EG(index.htm)");
?>
Good luck with this.
没有评论:
发表评论