Jump to content

jonnyroboto

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by jonnyroboto

  1. I have a form that I've built for a client. Real simple form with name, email, phone, other, and comments text fields. I also have 8 check boxes on there too. When I send myself a test email, it is styled the way I'd like, but the text fields are not returning to the email, only the check boxes. Next to name in the email it's blank. What could be a miss? Also, when I submit the form I'd like the Thank You page to open in a new window about 500px square with no scrolls, status, or resize. Thank you <!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> <link href="css/prosweep.css" rel="stylesheet" type="text/css" /> <link href="css/globalReset.css" rel="stylesheet" type="text/css" /> </head> <body> <?php echo ' <div id="header"> <div id="header_image"> <img src="../images/header.jpg" style="margin: 0 auto;" /> </div><!-- end #header_image --> </div><!-- end #header --> <div id="nav_top"> <div id="nav_top_container"> <ul> <li><a href="#">home</a></li> <li><a href="#">Services</a></li> <li><a href="#">Areas Serviced</a></li> <li><a class="selected" href="#">Contact Us</a></li> <li><a href="#">faq</a></li> <li><a href="#">links</a></li> <li><a href="#">gallery</a></li> </ul> </div><!-- end #nav_top --> </div><!-- end #nav_top_container --> <div id="container"> <div id="nav_main"> <img src="../images/contactInfo.jpg" /> </div> <div id="content"> <h1 class="content">Contact Us</h1> <form id="form" action="processContact.php" method="post" target="foo" onsubmit="window.open()"> <div align="center"> <table> <tr> <td>* Name:</td> <td><input type="text" name="name" size="30" /></td> </tr> <tr> <td>* Email:</td> <td><input type="text" name="email" size="30" /></td> </tr> <tr> <td>* Phone:</td> <td><input type="text" name="phone" size="30" /></td> </tr> </table> </div> <br /> <div align="center"> <table> <tr> <td colspan="2" align="center">* What can we help you with?</td> </tr> <tr> <td><input type="checkbox" name="box1" value="Street Sweeping" /></td><td>Street Sweeping</td> </tr> <tr> <td><input type="checkbox" name="box2" value="Parking Lot Sweeping" /></td><td>Parking Lot Sweeping</td> </tr> <tr> <td><input type="checkbox" name="box3" value="Facility Maintenance" /></td><td>Facility Maintenance</td> </tr> <tr> <td><input type="checkbox" name="box4" value="Commercial Landscape Maintenance" /></td><td>Commercial Landscape Maintenance</td> </tr> <tr> <td><input type="checkbox" name="box5" value="Hot Water Pressure Washing" /></td><td>Hot Water Pressure Washing</td> </tr> <tr> <td><input type="checkbox" name="box6" value="Roll-off Container Rental" /></td><td>Roll-off Container Rental</td> </tr> <tr> <td><input type="checkbox" name="box7" value="Hauling and Debris Removal" /></td><td>Hauling and Debris Removal</td> </tr> <tr> <td><input type="checkbox" name="box8" value="Other Information" /></td><td>Other</td> </tr> <tr> <td colspan="2" align="center"><input type="text" name="other" size="30" /></td> </tr> </table> <br /> </div> <font size="1"><i>* Required Fields</i></font><br /> <br /> <h2>Comments<br /><br /></h2> <div align="center"> <textarea name="feedback" rows="6" cols="30"></textarea> </div> <hr /> <br /><input type="submit" /><br /><br /> </form> </div> </div><!-- end #container --> <div id="footer"> <div id="nav_bottom"> <ul> <li><a href="#">home</a></li> <li><a href="#">Services</a></li> <li><a href="#">Areas Serviced</a></li> <li><a class="selected" href="#">Contact Us</a></li> <li><a href="#">faq</a></li> <li><a href="#">links</a></li> <li><a href="#">gallery</a></li> </ul> </div> </div><!-- end #footer --> '; ?> </body> </html> <?php /* Subject and Email Variables */ $emailSubject = 'Company Contact Form'; $webMaster = 'myemail@email.com'; /* Gathering Data Variables */ $nameField = $_POST['name']; $emailField = $_POST['email']; $phoneField = $_POST['phone']; $box1 = $_POST['box1']; $box2 = $_POST['box2']; $box3 = $_POST['box3']; $box4 = $_POST['box4']; $box5 = $_POST['box5']; $box6 = $_POST['box6']; $box7 = $_POST['box7']; $box8 = $_POST['box8']; $otherField = $_POST['other']; $feedbackField = $_POST['feedback']; $body = <<<EOD <br><hr><br> Name: $name <br> <br> Phone: $phone <br> <br> Email: $email <br> <br> Site Rating: $rating <br> <br> Info Needed: $box1, $box2, $box3, $box4, $box5, $box6, $box7, $box8 <br> <br> Other Information Requested: $other <br> <br> Comments: $feedback <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results Rendered HTML */ $theResults = <<<EOD <html> <head> <title>Thank you!</title> <style type="text/css"> h1 { color: #ffffff; text-align: center; } h2 { color: #ffffff; text-align: center; } h3 { color: #ffffff; text-align: center; } a:link { color: #330033; text-decoration: none; } a:visited { color: #000033; text-decoration: none; } a:hover { color: #663399; text-decoration: none; } </style> </head> <body bgcolor="#9999cc"> <form> <h1>Thank you.</h1><br> <h2>An email has been sent to us and we will be contacting you soon.</h2> <h3>Thank you again for visiting wdwvip.com You may click below to close this window.</h3> <div align="center"> <input type="button" value="Close Window" onClick="window.close()"></div> </form> <div align="center"> <a href="javascript:window.close()">Close Window</a> </div> </body> </html> EOD; echo "$theResults"; ?>
  2. I rechecked the code. I know, it is VERY inefficient code considering the methods available. I'm novice, very novice, ha ha. I checked the code for the closing braces on all the functions and they were there. Maybe they didn't post for some odd reason. The kicker was that getElementsByTagName. That "s" sent everything into no-buenoVille. Thank you for your help, it works just fine now. From now on, I'll get up on the new stuff so I'm not posting this ancient stuff on here, ha ha ha! Cheers!
  3. Ok. I have a form which needs required fields. I'm using a code that I found on lynda.com for making fields required. I made the necessary changes to my .htm file and linked the .js file up accordingly; however, it's letting the form go through without entering any info into the required fields. I have the form and javascript codes listed below: <form action="orfp1.php" method="post"> <table width="689" border="0" cellspacing="0" cellpadding="6"> <tr> <th scope="col"> <div align="left"> <label for="fullName">Full Name: <input type="text" name="fullName" id="fullName" class="reqd" /> </label> </div> </th> <th scope="col"> <div align="left"> <label for="email">Email: <input type="text" name="email" id="email" class="reqd" /> </label> </div> </th> </tr> <tr> <td> <div align="left"> <label for="dayPhone"><strong>Day Phone: <input type="text" name="dayPhone" id="dayPhone" class="reqd" /> <br /></strong>with area code <strong><br /></strong> </label> </div> </td> <td> <div align="left"> <label><strong>Evening Phone:</strong> <input type="text" name="evePhone" id="evePhone" /> </label> <br />with area code </div> </td> </tr> <tr> <td colspan="2" align="center"> <input type="reset" name="clear" id="clear" value="Reset Form" /> </td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" name="submit" id="submit" value="Submit Form" /> </td> </tr> </table> </form> window.onload = initForms; function initForms() { for (var i=0; i< document.forms.length; i++) { document.forms[i].onSubmit = function() { return validForm(); } } } function validForm() { var allGood = true; var allTags = document.getElementByTagName("*"); for (var i=0; i<allTags.length; i++) { if (!validTag(allTags[i])) { allGood = false; } } return allGood; function validTag(thisTag) { var outClass = ""; var allClasses = thisTag.className.split(" "); for (var j=0; j<allClasses.length; j++) { outClass += validBasedOnClass(allClasses[j]) + " "; } thisTag.className = outClass; if (outClass.indexOf("invalid") > -1) { thisTag.focus(); if (thisTag.nodeName == "INPUT") { thisTag.select(); } return false; } return true; function validBasedOnClass(thisClass) { var classBack = ""; switch(thisClass) { case "": case "invalid": break; case "reqd": if (allGood && thisTag.value == "") { classBack = "invalid "; } classBack += thisClass; break; default: classBack += thisClass; } return classBack; } } } Each one of my required fields has a class of "reqd". I also know that the .js file is being called because I added an alert on submit that gave me a message, which worked. Can someone tell me why the script isn't working? Thank you,
  4. thank you for replying. When I submit the form after checking all the boxes, it only shows the last one submitted. If my guest check all the boxes, is there a way to show all of them in my emial?
  5. I have a form that submits it's info to my email. When people check the ckeckboxes on my form, and submit, the info comes back to me as "array". I want to be able to see what it is they checked on so I can gather the proper info for when I call them back. Anyone know what I'm doing wrong? Form Code: <?php echo ' <body bgcolor="#9999cc"> <form action="processContact.php" method="post"> <font face="Arial, Helvetica, sans-serif"> <h1 align="center"><font size="5" color="#FFFFFF">Contact Us</font></h1> <div align="center"> <font size="2"><strong> <font color="#FFFFFF"> Name:</font></strong> <input type="text" name="name" size="30" /> </font> <br /> <br /> <font size="2"><font color="#FFFFFF"><strong>* Email:</strong></font> <input type="text" name="email" size="30" /> </div> <br /> <div align="center"> <font color="#FFFFFF"> <strong>Overall Rating of the site:</strong><br/> [<input checked="checked" name="rating" type="radio" value="good" />Good] [<input name="rating" type="radio" value="bad" />Fair] [<input name="rating" type="radio" value="ugly" />Bad]</font> <br /> <br /> <table> <tr> <td> <p align="left"><font color="#FFFFFF" size="2"><strong>* What can we help you with?</strong><br /> <input type="checkbox" name="box[]" value="Hotel Information and Reservations" />Hotel Information and Reservations<br /> <input type="checkbox" name="box[]" value="Vacation Home Information and Reservations" />Vacation Home Information and Reservations<br /> <input type="checkbox" name="box[]" value="Vacation Packages and Tickets" />Vacation Packages and Tickets<br /> <input type="checkbox" name="box[]" value="Affiliate Program Information" />Affiliate Program<br /> <input type="checkbox" name="box[]" value="Other Information" />Other </font> <font color="#FFFFFF"><input type="text" name="other" size="20" /></font></p> </td> </tr> </table> <font color="#FFFFFF"> <br /> <font size="1"><i>* Required Fields</i></font> <br /> <h2 align="center"><font color="#FFFFFF">Comments</font></h2> <div align="center"> <font face="Arial, Helvetica, sans-serif"><textarea name="feedback" rows="6" cols="30"></textarea></font> </div> <hr /> '; ?> <?php require_once('recaptchalib.php'); $publickey = "..."; // you got this from the signup page echo recaptcha_get_html($publickey); ?> <?php echo ' <br /><input type="submit" /> </form></body> '; ?> Processing Code: <?php require_once('recaptchalib.php'); $privatekey = "..."; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { die ("The reCAPTCHA wasn’t entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } /* Subject and Email Variables */ $emailSubject = 'Contact Form'; $webMaster = '...'; /* Gathering Data Variables */ $emailField = $_POST['email']; $nameField = $_POST['name']; $ratingField = $_POST['rating']; $box = $_POST['box']; $otherField = $_POST['other']; $feedbackField = $_POST['feedback']; $body = <<<EOD <br><hr><br> Email: $email <br> Name: $name <br> Site Rating: $rating <br> Info Needed: $box <br> Other Attraction Detail: $other <br> Comments: $feedback <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results Rendered HTML */ $theResults = <<<EOD <html> <head> <title>Thank you!</title> <style type="text/css"> h1 { color: #ffffff; text-align: center; } h2 { color: #ffffff; text-align: center; } h3 { color: #ffffff; text-align: center; } a:link { color: #330033; text-decoration: none; } a:visited { color: #000033; text-decoration: none; } a:hover { color: #663399; text-decoration: none; } </style> </head> <body bgcolor="#9999cc"> <form> <h1>Thank you.</h1><br> <h2>An email has been sent to us and we will be contacting you soon.</h2> <h3>Thank you again for visiting wdwvip.com You may click below to close this window.</h3> <div align="center"> <input type="button" value="Close Window" onClick="window.close()"></div> </form> <div align="center"> <a href="javascript:window.close()">Close Window</a> </div> </body> </html> EOD; echo "$theResults"; ?>
  6. I tried putting the headers in there but it gave me an internal server error. <?php require_once('recaptchalib.php'); $privatekey = "6LfD-wUAAAAAAA2-ZgXQuRi2_jPxMg197djp93ug"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { die ("The reCAPTCHA wasn’t entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } $name = $_POST['name'] ; $email = $_POST['email'] ; $phone = $_POST['phone'] ; $num_adult = $_POST['num_adult'] ; $num_child = $_POST['num_child'] ; $num_room = $_POST['num_room'] ; $arrivemonth = $_POST['arrivemonth'] ; $arriveday = $_POST['arriveday'] ; $arriveyear = $_POST['arriveyear'] ; $nights = $_POST['nights'] ; $attractions1 = $_POST['attractions1'] ; $attractions2 = $_POST['attractions2'] ; $attractions3 = $_POST['attractions3'] ; $attractions4 = $_POST['attractions4'] ; $attractions5 = $_POST['attractions5'] ; $other_attractions = $_POST['other_attractions'] ; $embody = "<html><head></head><body><br /><br />"; $embody .= "Name: $name<br />"; $embody .= "Phone: $phone<br />"; $embody .= "Number of Adults: $num_adult<br />"; $embody .= "Number of Children: $num_child<br />"; $embody .= "Number of Rooms: $num_room<br />"; $embody .= "Arival MM/DD/YY: $arrivemonth/$arriveday/$arriveyear<br />"; $embody .= "Number of Nights: $nights<br />"; $embody .= "Attractions: $attractions1, $attractions2, $attractions3, $attractions4, $attractions5<br />"; $embody .= "Other Attractions Detail: $other_attractions"; $embody .= "</body></html>"; $header .= "Content-type: text/html\r\n"; mail( "jgravato82@gmail.com", "Custom Vacation Package Form", $embody, "From: $email", $header ); header( "Location: http://www.wdwvip.com/thankyou.htm" ); ?>
  7. I love dreamweaver. I'm fixing this form and the processing script server side because it allows me to test the php right there without using apache or anything. Quick question for you. Where would I put the code to render my emaill in html? I fixed the silly errors and now I'm getting all the html code with my form info.
  8. Thank you both so much. I feel dumb about that one. I did see that I forgot the close at the last embody too. I've been staring at code all day, and haven't eaten a thing to speak of. Seems to be working now that you all helped me with those silly mistakes. Thanks again ya'll.
  9. I created a form that works, except for the clarity of the info I'm receiving via email. Here is my code: <?php require_once('recaptchalib.php'); $privatekey = "..."; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { die ("The reCAPTCHA wasn’t entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } $name = $_POST['name'] ; $email = $_POST['email'] ; $phone = $_POST['phone'] ; $num_adult = $_POST['num_adult'] ; $num_child = $_POST['num_child'] ; $num_room = $_POST['num_room'] ; $arrivemonth = $_POST['arrivemonth'] ; $arriveday = $_POST['arriveday'] ; $arriveyear = $_POST['arriveyear'] ; $nights = $_POST['nights'] ; $attractions1 = $_POST['attractions1'] ; $attractions2 = $_POST['attractions2'] ; $attractions3 = $_POST['attractions3'] ; $attractions4 = $_POST['attractions4'] ; $attractions5 = $_POST['attractions5'] ; $other_attractions = $_POST['other_attractions'] ; $embody = "<html><head></head><body><br /><br />"; $embody .= "Name: $name<br />"; $embody .= "Phone: $phone<br />"; $embody .= "Number of Adults: $num_adult<br />;" $embody .= "Number of Children: $num_child<br />;" $embody .= "Number of Rooms: $num_room<br />;" $embody .= "Arival MM/DD/YY: $arrivemonth/$arriveday/$arriveyear<br />;" $embody .= "Number of Nights: $nights<br />;" $embody .= "Attractions: $attractions1, $attractions2, $attractions3, $attractions4, $attractions5<br />;" $embody .= "Other Attractions Detail: $other_attractions;" $embody .= "</body></html> mail( "me@myemail.com", "Custom Vacation Package Form", $embody, "From: $email" ); header( "Location: http://www.mywebsite.com/thankyou.htm" ); ?> I am receiving an error that says: Parse error: parse error in /www/cgi/sendmail2.php on line 34. What am I doing wrong? Thank you,
  10. great! Thank you. So by replacing $_REQUEST with $_POST, what will that do?
  11. I have created a form and have set up all the appropriate php docs to process and even verify captcha. I have sucessfully redirected my guests to a new window containing the form and even a thank you page on submission. The form even sends me emails but: 1: the formatting of the mail is very confusing and 2: I have check boxes that aren't being recognized and recorded on my form. here is the code for my form: <?php echo ' <body bgcolor="#9999cc"> <form action="sendmail.php" method="post"> <font face="Arial, Helvetica, sans-serif"> <h1 align="center"><font size="5" color="#FFFFFF">Contact Us</font></h1> <div align="center"> <font size="2"><strong> <font color="#FFFFFF"> Name:</font></strong> <input type="text" name="name" size="30" /> </font> <br /> <br /> <font size="2"><font color="#FFFFFF"><strong>* Email:</strong></font> <input type="text" name="email" size="30" /> </div> <br /> <div align="center"> <font color="#FFFFFF"> <strong>Overall Rating of the site:</strong><br/> [<input checked="checked" name="rating" type="radio" value="good" />Good] [<input name="rating" type="radio" value="bad" />Fair] [<input name="rating" type="radio" value="ugly" />Bad]</font> <br /> <br /> <table> <tr> <td> <p align="left"><font color="#FFFFFF" size="2"><strong>* What can we help you with?</strong><br /> <input type="checkbox" name="info_needed" value="Hotel Information and Reservations" />Hotel Information and Reservations<br /> <input type="checkbox" name="info_needed" value="Vacation Home Information and Reservations" />Vacation Home Information and Reservations<br /> <input type="checkbox" name="info_needed" value="Vacation Packages and Tickets" />Vacation Packages and Tickets<br /> <input type="checkbox" name="info_needed" value="Affiliate Program Information" />Affiliate Program<br /> <input type="checkbox" name="info_needed" value="Other Information" />Other </font> <font color="#FFFFFF"><input type="text" name="other_detail" size="20" /></font></p> </td> </tr> </table> <font color="#FFFFFF"> <br /> <font size="1"><i>* Required Fields</i></font> <br /> <h2 align="center"><font color="#FFFFFF">Comments</font></h2> <div align="center"> <font face="Arial, Helvetica, sans-serif"><textarea name="feedback" rows="6" cols="30"></textarea></font> </div> <hr /> '; ?> <?php require_once('recaptchalib.php'); $publickey = "..."; // you got this from the signup page echo recaptcha_get_html($publickey); ?> <?php echo ' <br /><input type="submit" /> </form></body> '; ?> and here is the code for my processing page: <?php require_once('recaptchalib.php'); $privatekey = "..."; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { die ("The reCAPTCHA wasn’t entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; $rating = $_REQUEST['rating'] ; $info_needed = $_REQUEST['info_needed'] ; $other_detail = $_REQUEST['other_detail'] ; $feedback = $_REQUEST['feedback'] ; $embody = "$name $rating $info_needed $other_detail $feedback" ; mail( "jgravato82@gmail.com", "Contact Form", $embody = "$name $rating $info_needed $other_detail $feedback", "From: $email" ); header( "Location: http://www.wdwvip.com/thankyou.htm" ); ?> Can anyone tell me what I'm doing wrong with my info_needed parameter and is there a simple way to format the results of my form so that they don't just follow one another in my emails (i.e. name rating feedback, all separated by spaces with no commas or anything) Thank you,
  12. i have a final question, if you don't mind me asking. I am trying to include this form into an htm page. would I just simply use an "include" for this?
  13. WOW! It worked! Thank you so much! The only reason I did it the other way was because it was two different pieces of code. the top was the validation for the captcha and the bottom was to process the form and send my clients to a thanks page. Thank you for your help, JonnyRoboto
  14. <?php require_once('recaptchalib.php'); $privatekey = "..."; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { die ("The reCAPTCHA wasn’t entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } ?> <?php $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; mail( "jgravato@gmail.com", "Contact Form", $message, "From: $email" ); header( "Location: http://www.wdwvip.com/thankyou.htm" ); ?>
  15. the entire page of code? the code I just showed you?
  16. Thank you, that solved the problem with my form. I'm actually getting to the point where I can enter info into the form and validate it using the captcha. The code I'm using for the processing page is: Line 21 is the one that reads: header( "Location: http://www.wdwvip.com/thankyou.htm" ); and I'm getting an error message that reads: Warning: Cannot add header information - headers already sent by (output started at /www/cgi/sendmail.php:15) in /www/cgi/sendmail.php on line 21 What I'm trying to do is send my guests to a thank you page after they fill out the form. Is there a better way to do this? Thank you, JonnyRoboto
  17. Hi, I'm trying to use a php form on the contact-us page of my website. I have a sendmail.php doc that processes the script, and I'm trying to apply a captcha code from reCaptcha, so I have a library php doc as well. These files are all located in my cgi folder on the server but I'm getting an error message that reads: Parse error: parse error in /www/cgi/form.php on line 2 when I try to test the form. All the other phps seem to be working except this one. Can anyone see how I'm getting this error message from the code I've provided? Can someone help me figure this out? Thank you, JonnyRoboto
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.