Jump to content

How do I get the message submitted throuhg m form


Guest Bongnwi

Recommended Posts

Guest Bongnwi

HelloI have the following php codes on my page and can not have any message in my box after sumitting all the information. My email address is bong_nwi@yahoo.com.what can be the problem. Please I need your helpformhandler scripts<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>mailhandler Script</title></head><body><?php//configure all variables$to ="bong_nwi@yahoo.com";$name = $_POST['name']; $phone = $_POST['phone']; $email = $_POST['email']; $address = $_POST['address']; $comments = $_POST['comments']; //if there is an email address check if its valid and hang up if invalid if(!$email == "" && (!strstr($email,"@") || !strstr($email,"."))) {echo "<h3>Use Back - Enter valid e-mail</h3>\n"; echo "<h2>Feedback was NOT submitted</h2>\n";exit();}//check if all fields are specified and hang up if emptyif(empty($name) || empty($phone) || empty($email) || empty($address) || empty($comments )) {echo "<h2>Use Back - fill in all fields</h2>\n";exit();}//compose the message with a date and subjects$todayis = date("l, F j, Y, g:i a") ;$message = " $todayis [EST] \n";$message.=$comments."\n"; $message.="From: $name ($email)\n";$message.="Address: $address";$message.="Phone No: $phone";$subject="contact from your website";//send the message@mail($to, $subject, $message, $from);?><p align="center">Date: <?php echo $todayis ?> <br />Thank You : <?php echo $name ?> ( <?php echo $email ?> ) <br />Your Message has been Submitted <br /><strong>We will soon get back to you </strong> <br /><br /><br /><a href="index.html"> Next page </a> </p> </body></html>FORM SCRIPTS BOLLOW<form action="formhandler.php" method="post"> <input type="hidden" name="required" id="required" value="name,phone,email,address,msg,commentbox" /> </p> <fieldset > <legend><strong>Personal Details</strong></legend><br /> <label for="name">Name:</label> <input type="text" name="name" />*<br /><br /> <label for="phone">Phone:</label> <input type="text" name="phone" />*<br /><br /> <label for="email">E-mail:</label> <input type="text" name="email" />*<br /><br /> <label for="address">Address:</label> <input type="text" name="address" /> * <br /><br /> </fieldset> <fieldset> <legend><strong>Your Message</strong></legend> <textarea rows= "8" cols= "25" name= "comments"> </textarea> <input type="submit" value="Send Message" /> <input type="reset" value="Reset" /> </fieldset> </form>

Link to comment
Share on other sites

You forgot to specify $from, but that should not matter. What host are you using / does your host have a SMPT server set up?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...