syco Posted July 25, 2007 Share Posted July 25, 2007 how do i make it so when they click the submit button it emails it to me? Link to comment Share on other sites More sharing options...
smartalco Posted July 25, 2007 Share Posted July 25, 2007 set the action of the form to a page that uses php to retrieve the variables from the form, then emails them to you, heres the doc on the mail() function Link to comment Share on other sites More sharing options...
jhecht Posted July 25, 2007 Share Posted July 25, 2007 Two pages: first page looks like this: <form action="otherPage.php" method="post">Username : <input type="text" name="name" /><br />Email : <input type="text" name="email" /><br /><input type="submit" value="Send!" /></form> Second page looks like this: <?php$data = $_POST;$message = '';$errors = "";foreach($data as $key=>$value){ if(!empty($data) OR preg_match("/[a-z0-9]{3,}\s?/i",$value)){ $message.= "$key : $value\n"; }else{ $errors.= "You left $key blank. Please, go back and fill it in.<br />\n"; }}$to = "your@email.address";$subject = "Form Mailed from website";if(strlen($errors) > 0 ){ echo $errors; }else{ mail($to,$subject,$message); }?> that should do it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.