asdgq9 Posted March 11, 2011 Share Posted March 11, 2011 Hi, I want to post a simple comments box at the bottom of one of my web pages that will send the data from 3 different inputs, named "name," "costumer_mail," and "detail," to my email, but I am new to php. Can someone look at my php code and see what is wrong? I'm having trouble trying to find a spot to put the input "name" in the php. PHP: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Send Data Form</title> </head> <body> <?php // Contact subject $subject='Comment Posted From Website'; // Details $message=$_POST['detail']; // Mail of sender // From $headers=$_POST['customer_mail']; // Enter your email address $to ='******my e-mail address*****'; { mail($to,$subject,$message,$headers); } // Check, if message sent to your email // display message "Thank you for your submission" if($send_contact){ echo "Thank you for your submission"; } else { echo "ERROR, your comment was not sent"; } HTML form: <form method="post" action="send_contact.php" name="comment_form"> <table cellspacing="0" style="width: 153%" class="style6"> <tr> <td style="width: 286px; height: 29px;">Name:</td> <td style="height: 29px"> <input name="name" type="text" style="width: 250px; height: 22px"/> </td> </tr> <tr> <td style="width: 286px">E-mail Address/Phone Number:</td> <td> <input name="customer_mail" type="text" class="style4"style="width: 250px; height: 22px" /> </td> </tr> <tr> <td colspan="2" class="style5"> <textarea name="detail" style="width: 582px; height: 157px"></textarea> </td> </tr> <tr> <td colspan="2" class="style7" valign="top"> <input type="submit" name="Submit" style="width: 87px" value="submit" /> </td> </tr> </table> </form> Quote Link to comment Share on other sites More sharing options...
ambbarees Posted March 11, 2011 Share Posted March 11, 2011 You can just concat the name to your "$message" by having $message="Comment from ".$_POST['name'].": ".$_POST['detail']; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.