I have this html contact form:-
"""'''''''
<form action="submitted.html" method="post">
<input name="textfield" type="text" class="inp" id="textfield" />
<input name="textfield2" type="text" class="inp" id="textfield2" />
<input name="textfield3" type="text" class="inp" id="textfield3" />
<input name="textfield4" type="text" class="inp" id="textfield4" />
<textarea name="textarea" cols="45" rows="5" class="inp" id="textarea"></textarea>
<input name="textfield5" type="text" class="inp" id="textfield5" />
<input type="image" name="submit" src="images/submit.jpg" width="45" height="20" />
</form>
"""'''''''
I want that when user clicks on the 'submit' button, all info goes to my email address.
Please help me. I tried googling it but all codes I found are too tricky for me.
Your help will be highly appreciated.
Thank you in advance.
Php Contact form
Moderator: General Moderators
Re: Php Contact form
Where is your PHP? Where is it failing? What's the problem, exactly?
Re: Php Contact form
First off, like said before. Please post your PHP code.
Secondly, your action on the form is posting to an HTML file, unless your .htaccess is configured to parse html files as PHP, this won't work no matter what your code you have in submitted.html
Now, for the juicy part.
Secondly, your action on the form is posting to an HTML file, unless your .htaccess is configured to parse html files as PHP, this won't work no matter what your code you have in submitted.html
Now, for the juicy part.
Code: Select all
//Post's info from form.
$textfield = $_POST['textfield'];
$textfield2 = $_POST['textfield2'];
$textfield3 = $_POST['textfield3'];
$textfield4 = $_POST['textfield4'];
$textfield5 = $_POST['textfield5'];
$textarea = $_POST['textarea'];
$subject = 'Your form has been filled out.';
$to = 'YOUREMAIL@ADDRESS.COM';
$from = 'Your Self';
//Sends Emails.
$headers = "From: $from\r\n";
$headers .= "X-Priority: 3\r\n";
$headers .= "X-MSMail-Priority: Normal\r\n";
$message = $textfield.'<br />'.$textfield2.'<br />'.$textfield3.'<br />'.$textfield4.'<br />'.$textfield5.'<br />'.$textarea;
mail($to, $subject, $message, $headers);