k_ind Posted May 27, 2008 Share Posted May 27, 2008 Hi All, I am trying to create a contact form. The problem i am facing is with the 'submit' button. I want that when the submit button is pressed then the info of the form should go to my email. Can anyone tell the code for that? Thanks! Quote Link to comment Share on other sites More sharing options...
conker87 Posted May 27, 2008 Share Posted May 27, 2008 Check out the mail() function on php.com. Quote Link to comment Share on other sites More sharing options...
gortron Posted May 27, 2008 Share Posted May 27, 2008 Hi K_ind, The approach I would use is below. There are plenty of ways you could expand it but its the basic outline. It shows a form where you can enter your name and it will email the specified email address with the name you entered in the form. <?php if ($_POST["Submit"]=="Submit") { // Get form variables $name=$_POST["frm_name"]; // mail mail("email@address.com", "Email Subject", "The name entered in the form was $name", $headers)) { } ?> <form action="scriptname.php"> <input type="text" name="frm_name"> <input tye="Submit" name="Submit" value="Submit"> </form> Quote Link to comment Share on other sites More sharing options...
k_ind Posted May 27, 2008 Author Share Posted May 27, 2008 Thanks for the replies! I am a just a beginner in this area, so pls dont mind if ask somethings which r basics. My other query is I have wampserver on my desktop. Now how to run my files on it to check whats the output? Thanks Quote Link to comment Share on other sites More sharing options...
gortron Posted May 27, 2008 Share Posted May 27, 2008 Im afraid I can't answer that one, I don't know anything about wampserver Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.