Click to See Complete Forum and Search --> : Submit Button


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.

TheRave
03-06-2008, 08:59 AM
Does your host support php?

jay_zone
03-06-2008, 09:35 AM
Hi thanks,

Im not quit sure, but I think they do.

Freewebtown.com is my provider. Just in case they don't, is there any other way I could do the same project?

Thanks for your help.

TheRave
03-06-2008, 09:41 AM
I've just replied to your PM.