csimms Posted September 27, 2006 Share Posted September 27, 2006 I am in the process of creating a form in Dreamweaver, but a friend of mine had told me I should use PHP to handle the processing of the form.I have never used PHP and have been reading up on the basics and need some help with handling the form.In the form I have the following<FORM name=Comment action="process.php" method="post">For the prcocess.php I havethis so far<form name=comment method=post action=contact_thanks.php><p class=bodymd>All fields of this form are required to be filed in...</p><p class=bodymd>Fill in the ones you missed, they are listed below.</p><p class=bodymd>Your First Name<br><input type=text name=firstname></p><p class=bodymd>Your Last Name<br><input type=text name=lastname></p><p class=bodymd>Your Email Address<br><input type=text name=Emailaddress></p><p class=bodymd>Enter Date<br><input type=text name=Date></p><p class=bodymd>Select Class Taken<br><select=option name=classtaken></p><p class=bodymd>Comment or Questions<br><textarea name=Comment rows=20 cols=100></textarea></p><input type=submit name=Submit value=Submit><input type=reset name=Reset value=Clear Form></form> I really need some help.. I have tried serveral different ways, what I need to happen is to have the form information the end user fills out sent to my email address in plain text or in the form format if possible..I am trying to create a commment form for my site.. I would also like to put in place a way to stop any bots from sending spam..Thank you for your help.. Link to comment https://forums.phpfreaks.com/topic/22283-need-help-with-form-using-_post/ Share on other sites More sharing options...
kenrbnsn Posted September 27, 2006 Share Posted September 27, 2006 The easiest way to put the contents of a form into an email message is:[code]<?phpif (isset($_POST['submit'])) { $body = "The following information was sent via the form:\n"; $body .= print_r(array_map(stripslashes,$_POST),true)); mail($to,$subject,$body,$headers);?>[/code]It's not formatted, but it is completely readable.Ken Link to comment https://forums.phpfreaks.com/topic/22283-need-help-with-form-using-_post/#findComment-99805 Share on other sites More sharing options...
phporcaffeine Posted September 27, 2006 Share Posted September 27, 2006 Well, if you are just looking to email the form values then you can do it ALL in HTML with ' mailto: 'but in php ...<?phpif ($_POST) { foreach ($_POST as $key => $value) { $data .= "Element ($key): = $value"; }}$headers .= "From: \"[email protected]\"\n";mail("[email protected]", "Your subject", $data, $headers);?><html><head><title></title></head><body><form name=comment method=post action=contact_thanks.php><p class=bodymd>All fields of this form are required to be filed in...</p><p class=bodymd>Fill in the ones you missed, they are listed below.</p><p class=bodymd>Your First Name<input type=text name=firstname></p><p class=bodymd>Your Last Name<input type=text name=lastname></p><p class=bodymd>Your Email Address<input type=text name=Emailaddress></p><p class=bodymd>Enter Date<input type=text name=Date></p><p class=bodymd>Select Class Taken<select=option name=classtaken></p><p class=bodymd>Comment or Questions<textarea name=Comment rows=20 cols=100></textarea></p><input type=submit name=Submit value=Submit><input type=reset name=Reset value=Clear Form></form></body></html> Link to comment https://forums.phpfreaks.com/topic/22283-need-help-with-form-using-_post/#findComment-99811 Share on other sites More sharing options...
csimms Posted September 30, 2006 Author Share Posted September 30, 2006 thank you for your help.. now how would i redirect the page to a thank you page?thanks for all of your help... Link to comment https://forums.phpfreaks.com/topic/22283-need-help-with-form-using-_post/#findComment-101483 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.