mytdred Posted June 13, 2013 Share Posted June 13, 2013 Hi guys I'm new to this. I tried to post this yesterday,thought it posted but don't see it today. this is my problem: This is my first try at php.I have a contact form with: First Name, Last Name, Email, Comments, a checkbox for newsletter, and a couple of buttons to reset and to submit. It works but does not send the the comment section or the or the check box. Being my first time working with php I'm stuck, and the band is really needing me to get this done. Any help would be greatly appreciated! Thank you! I did this with dreamweaver. Thanks again! Code Below: <!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 http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Comments</title> <style type="text/css"> <!-- body,td,th { color: #FFFFFF; } body { background-color: #000000; background-image: url(/mcfunkband/public_html/images/aa_stars.jpg); } --> </style></head> <body> <?php $fname = $_POST['fname']; $lname = $_POST['lname']; $email = $_POST['email']; $comments = $_POST['comments']; $newsletter = $_POST['newsletter']; //Sending Email to form owner $header = "From: $email\n" . "Reply-To: $email\n"; $subject = "Submission From My Form"; $email_to = "***@****.com"; $message = "name: $fname . $lname\n" . "email: $email\n"; mail($email_to, $subject ,$message ,$header ) ; ?> _______________________________________________________________________________________________ html: _______________________________________________________________________________________________ <form id="form1" name="form1" method="post" action="result.php"> <table width="100%" border="5"> <tr> <td><div align="right"> <label for="fname">First Name:</label> </div></td> <td><div align="left"> <input type="text" name="fname" id="fname" /> </div></td> </tr> <tr> <td><div align="right"> <label for="lname">Last Name:</label> </div></td> <td><div align="left"> <input name="lname" type="text" id="lname" maxlength="25" /> </div></td> </tr> <tr> <td><div align="right"> <label for="email">Emai:l</label> </div></td> <td><div align="left"> <input type="text" name="email" id="email" /> </div></td> </tr> <tr> <td><div align="right"></div></td> <td><div align="left"></div></td> </tr> <tr> Quote Link to comment Share on other sites More sharing options...
gizmola Posted June 13, 2013 Share Posted June 13, 2013 I don't see those form fields in your form code. Quote Link to comment Share on other sites More sharing options...
mytdred Posted June 13, 2013 Author Share Posted June 13, 2013 Sorry but I don't follow. Here is the page http://mcfunkband.com/BookingInfo.html thanks for looking. Quote Link to comment Share on other sites More sharing options...
mytdred Posted June 13, 2013 Author Share Posted June 13, 2013 Those are the div's in the html code Quote Link to comment Share on other sites More sharing options...
mytdred Posted June 13, 2013 Author Share Posted June 13, 2013 Sorry but I'm at a lost I built the site in dreamweaver and I thought divs were what they were called Quote Link to comment Share on other sites More sharing options...
ginerjm Posted June 13, 2013 Share Posted June 13, 2013 Get rid of all those divs!!! Needless. Plus your initial post shows only 3 input fields - where are the rest. The interface between html and php is the vars identified by the "name=" attributes of input tags. Plus handling checkboxes is tricky for newcomers so you should google something like "php handling checkboxes" and look for a good example. Plenty of them out there. Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted June 13, 2013 Share Posted June 13, 2013 I would be careful with rushing the form. In addition to it not working, the script which sends out the e-mail could be used for e-mail injections. Note that there are many articles online for more information: https://www.google.com/search?q=php+injection+email As for getting something online soon, have you considered using a third-party solution? Google forms, for example, are free and can be embedded within existing websites. https://support.google.com/drive/answer/87809?hl=en The customization options are a little to be desired, but it's something to consider while you figure out an alternative. Quote Link to comment Share on other sites More sharing options...
krishnadaspc Posted June 14, 2013 Share Posted June 14, 2013 Hello Mytdred, You don't put any submit field on your form. That is why you are not getting the values I believe. Add the below code at the end of your form. Also add the comment field and other needed fields to your form. <input type="submit" name="submit" value="submit"> Regards, Krishnadas 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.