Jump to content

submit button help


syco

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...