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 = '[email protected]'; /* 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,
×
×
  • 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.