Hi all,

i am bulding a website and for that i need a contact page through which my 
visitors should be able to send me a message to my email id through the contact 
form.
I dont know much about  php, so i used a code available at some site to build 
my contact form .
But after uploading the pages to the server i saw that by pressing the send 
button i am always getting the error message which i gave in the php page .

do i need to change anything in the php page or html page.
please help me to build the contact form.
  
HTML PAGE

<h2>Contact Me</h2>
<form id="contacts-form" method="POST" action="contact.php" >
<fieldset>
 <div class="field"><label>Your Name:</label><input type="text" name="name" 
value=""/></div>
 <div class="field"><label>Your E-mail:</label><input type="text" name="email" 
value=""/></div>
<div class="field"><label>Your message:</label><textarea name="message" cols="" 
rows=""></textarea></div>
 <div class="wrapper">
 <div class="button"><input type="submit" value="Send Your Message!" 
name="submit"</div>
    </div>
   </fieldset>
   </form>



PHP PAGE(CONTACT.PHP)

<?php
if(isset($_POST['submit'])) {

$to = "[email protected]";
$subject = "You have got a mail from www.example.com";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
 
$body = "From: $name_field\n E-Mail: $email_field\n Message:\n $message";
 
echo "Data has been submitted";

mail($to, $subject, $body);

} else {

echo "Message cannot be sent at this time.Please try again later!";

}
?>


Regards,
Subhash




      Connect more, do more and share more with Yahoo! India Mail. Learn more. 
http://in.overview.mail.yahoo.com/

Reply via email to