jay_zone
03-06-2008, 08:22 AM
Hi everyone,
I would like to ask for a help with the problem im encountering at the moment regarding with creating a contact page.
Im trying to create a page which the visitors can just fill up the forms then when they cilck on submit button the message they want to send will directly go to the email assigned.
I have tried to test it myself but unfortunately when I click on the submit button, there is a pop up window coming out asking me if I would like to download the file.
here is the sample of the code: for the forms
<form method="post" action="contact.php">
Email: <input name="email" type="text"><br>
Message:<br>
<textarea name="message" rows="15" cols="40"></textarea><br>
<input name="Send Email" type="submit" id="Send Email">
</form>
here is the code for the php:
<?php
$to = "example@provider.com";
$subject = "Contact Us";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
?>
I just put the example@provider.com to cover up the real email address. And contact.php is saved as php file in the same directory.
An advice is highly appreciated. Thank you very much.
I would like to ask for a help with the problem im encountering at the moment regarding with creating a contact page.
Im trying to create a page which the visitors can just fill up the forms then when they cilck on submit button the message they want to send will directly go to the email assigned.
I have tried to test it myself but unfortunately when I click on the submit button, there is a pop up window coming out asking me if I would like to download the file.
here is the sample of the code: for the forms
<form method="post" action="contact.php">
Email: <input name="email" type="text"><br>
Message:<br>
<textarea name="message" rows="15" cols="40"></textarea><br>
<input name="Send Email" type="submit" id="Send Email">
</form>
here is the code for the php:
<?php
$to = "example@provider.com";
$subject = "Contact Us";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
?>
I just put the example@provider.com to cover up the real email address. And contact.php is saved as php file in the same directory.
An advice is highly appreciated. Thank you very much.