Jump to content
xisto Community
Sign in to follow this  
cragllo

Php Contact Form contact forms made easy...

Recommended Posts

Here is a simple script to make a contact form with PHP.

First off you make a simple contact form, insert the following into any page:

<form method="post" action="form.php">[/br]Name:<input name="name" type="text" id="name"><br>[br]Email:<input name="email" type="text" id="email"><br>[/br]Subject:<input name="subject" type="text" id="subject"><br>[br]Message:<textarea name="comments" id="textarea"></textarea><br>[/br]<input type="submit" name="Submit" value="SUBMIT">[br]</form>

Now make a page called 'form.php' and inser the following only! No html tags!
<?php[br][/br]//Declare the variables[br]$recipient = "YOUR@EMAIL.HERE";[/br]$message = "name: $name[br]email: $email[/br]subject: $subject[br]message: $comments";[br][/br]//Contents of form[/br]$name=$_POST['name'];[br]$email=$_POST['email'];[/br]$subject=$_POST['subject'];[br]$comments=$_POST['comments'];[br][/br]//mail() function sends the mail[/br]mail($recipient,$subject,$message);[br][/br]//This line sends to thankyou page when finished[br]header("Location: thankyou.php");[/br]?>
To finnish you just need to make a page called 'thankyou.php' to thank the person for contacting you.

I hope this will help someone out there!

Share this post


Link to post
Share on other sites

Whatever it is, it's not as good as what you put down, simple, and small-sized.

<{POST_SNAPBACK}>


Whats not simple about his coding? it looks very simple to me and doesnt use anything advanced... I dont think you will find anything easier unless you just download a contact script and use that instead of simply coding it yourself :D , besides PHP is fun stuff

 

**Edit, im sorry, its 3am here right now and i have been misreadin stuff alot in the past 2 hours, i thought u were complaing about his code :D , ne ways sorry about that.

Off to bed for me, ZZzzzzzZZzzz :D

Share this post


Link to post
Share on other sites

Whats not simple about his coding? it looks very simple to me and doesnt use anything advanced... I dont think you will find anything easier unless you just download a contact script and use that instead of simply coding it yourself  :D , besides PHP is fun stuff

 

**Edit, im sorry, its 3am here right now and i have been misreadin stuff alot in the past 2 hours, i thought u were complaing about his code  :D , ne ways sorry about that.

Off to bed for me, ZZzzzzzZZzzz :D

<{POST_SNAPBACK}>


Lol, now that's hillarious, and I just got back to replying to this message... i feel kinda stupid. And no I wasn't complaining (duh) and uh, it would be pointless to tell you to go to bed earlier, but you should do it newayz.

Share this post


Link to post
Share on other sites

// send email to
function sendmail($from,$subject,$body)
{
$to="youremail@youremail.com";
$headers = "MIME-Version: 1.0 \r \n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \r \n";
$headers .= "To: $to \r \n";
$headers .= "From: $sender \r \n";
$send=mail($to,$subject,$body,$headers);
if(isset($send)){ return 1; }
else { return 0;}
}


//Contents of form
$email=$_POST['email'];
$subject=$_POST['subject'];
$comments=$_POST['comments'];

//mail() function sends the mail
if(sendmail($email,$subject,$comments)==1){header("Location: thankyou.php");}
else{echo "Sorry! we got a problem with sending email, please try again later";}

This is what i have done.

I hope you love it.

Thanks & Best Regards,
Dorei

http://forums.xisto.com/no_longer_exists/

find out for more source code with a small and easy stuff.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.