•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,053 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,420 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 315 | Replies: 2 | Solved
![]() |
•
•
Join Date: Sep 2006
Posts: 14
Reputation:
Rep Power: 3
Solved Threads: 0
I have no idea why, but the form mailer I'm using is not working correctly. Granted, I'm still a newb, but everything in the code looks fine to me.
I'm using a modified version of the free form mailer available at www.TheDemoSite.co.uk
The exact problem is this: I fill out the form, hit submit, and then stare in frustration as the page reloads with a blank form, instead of showing me the confirmation message and sending the email it's supposed to.
Maybe I just need another pair of eyes on this. Please, if anyone can help, I'm lost.
Here's the code I'm working with (which I've attached--found at the bottom of this post--for easier reading, as well):
HTML
Just in case, here's the CSS:
And finally, the PHP:
I'm using a modified version of the free form mailer available at www.TheDemoSite.co.uk
The exact problem is this: I fill out the form, hit submit, and then stare in frustration as the page reloads with a blank form, instead of showing me the confirmation message and sending the email it's supposed to.
Maybe I just need another pair of eyes on this. Please, if anyone can help, I'm lost.
Here's the code I'm working with (which I've attached--found at the bottom of this post--for easier reading, as well):
HTML
html Syntax (Toggle Plain Text)
<!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>Share Your Experience</title> <link href="style.css" rel="stylesheet" type="text/css" /> </head> <body> <form name="phpformmailer" action="contact_processCS.php" method="post"> <div style="text-align:left"> <div id="wrapper"> <table id="banner"> <tr> <td width="732" height="114"></td> </tr> </table> <div> <p class="header">Thank you for choosing company for your service needs.</p> <br /> <p class="header2">Our goal is to provide you with the best possible service, and your input is vital to our success. <br /> <br /> Please take a few moments to let us know how we are doing.</p> <br /> <br /> </div> <div id="contact"> Your first name:<font class="required">*</font> </div> <div id="contact_text"><input type="text" name="FirstName" size="30" /></div> <br /> <br /> <div id="contact"> Your last name:<font class="required">*</font> </div> <div id="contact_text"><input type="text" name="LastName" size="30" /></div> <br /> <br /> <div id="contact"> Your telephone number:<font class="required">*</font> </div> <div id="contact_text"><input type="text" name="TelephoneNumber" size="30" /></div> <br /> <br /> <div id="contact"> Your email address:<font class="required">*</font> </div> <div id="contact_text"><input type="text" name="Email" size="50" /></div> <br /> <br /> <div id="contact"> Confirm email:<font class="required">*</font> </div> <div id="contact_text"><input type="text" name="Email2" size="50" /></div> <br /> <br /> <div id="tablepos"> <table cellpadding="4" cellspacing="1"> <tr class="table_head" bgcolor="#64077a"> <td width="420"></td> <td width="50">Strongly<br />Agree</td> <td width="50">Agree</td> <td width="50">Does Not<br />Apply</td> <td width="50">Disagree</td> <td width="50">Strongly<br /> Disagree</td> </tr> <tr> <td class="cell_left">My telephone calls are answered promptly</td> <td class="cell_radio"><input type="radio" name="TelephoneRadio" value="Strongly Agree"/></td> <td class="cell_radio"><input type="radio" name="TelephoneRadio" value="Agree"/></td> <td class="cell_radio"><input type="radio" name="TelephoneRadio" value="Does Not Apply"/></td> <td class="cell_radio"><input type="radio" name="TelephoneRadio" value="Disagree"/></td> <td class="cell_radio"><input type="radio" name="TelephoneRadio" value="Strongly Disagree"/></td> </tr> <tr bgcolor="#d8bbdf"> <td class="cell_left">company provides timely responses to my requests</td> <td class="cell_radio"><input type="radio" name="ResponseRadio" value="Strongly Agree"/></td> <td class="cell_radio"><input type="radio" name="ResponseRadio" value="Agree"/></td> <td class="cell_radio"><input type="radio" name="ResponseRadio" value="Does Not Apply"/></td> <td class="cell_radio"><input type="radio" name="ResponseRadio" value="Disagree"/></td> <td class="cell_radio"><input type="radio" name="ResponseRadio" value="Strongly Disagree"/></td> </tr> <tr> <td class="cell_left">company Customer Service representatives are helpful and knowledgeable</td> <td class="cell_radio"><input type="radio" name="CSRepsRadio" value="Strongly Agree"/></td> <td class="cell_radio"><input type="radio" name="CSRepsRadio" value="Agree"/></td> <td class="cell_radio"><input type="radio" name="CSRepsRadio" value="Does Not Apply"/></td> <td class="cell_radio"><input type="radio" name="CSRepsRadio" value="Disagree"/></td> <td class="cell_radio"><input type="radio" name="CSRepsRadio" value="Strongly Disagree"/></td> </tr> <tr bgcolor="#d8bbdf"> <td class="cell_left">My services and events are conducted correctly & professionally</td> <td class="cell_radio"><input type="radio" name="ConductedRadio" value="Strongly Agree"/></td> <td class="cell_radio"><input type="radio" name="ConductedRadio" value="Agree"/></td> <td class="cell_radio"><input type="radio" name="ConductedRadio" value="Does Not Apply"/></td> <td class="cell_radio"><input type="radio" name="ConductedRadio" value="Disagree"/></td> <td class="cell_radio"><input type="radio" name="ConductedRadio" value="Strongly Disagree"/></td> </tr> <tr> <td class="cell_left">company informs me about new services or service changes</td> <td class="cell_radio"><input type="radio" name="InformedRadio" value="Strongly Agree"/></td> <td class="cell_radio"><input type="radio" name="InformedRadio" value="Agree"/></td> <td class="cell_radio"><input type="radio" name="InformedRadio" value="Does Not Apply"/></td> <td class="cell_radio"><input type="radio" name="InformedRadio" value="Disagree"/></td> <td class="cell_radio"><input type="radio" name="InformedRadio" value="Strongly Disagree"/></td> </tr> <tr bgcolor="#d8bbdf"> <td class="cell_left">company is easy to do business with</td> <td class="cell_radio"><input type="radio" name="EasyRadio" value="Strongly Agree"/></td> <td class="cell_radio"><input type="radio" name="EasyRadio" value="Agree"/></td> <td class="cell_radio"><input type="radio" name="EasyRadio" value="Does Not Apply"/></td> <td class="cell_radio"><input type="radio" name="EasyRadio" value="Disagree"/></td> <td class="cell_radio"><input type="radio" name="EasyRadio" value="Strongly Disagree"/></td> </tr> <tr> <td class="cell_left">company deals with problems efficiently and effectively</td> <td class="cell_radio"><input type="radio" name="ProblemsRadio" value="Strongly Agree"/></td> <td class="cell_radio"><input type="radio" name="ProblemsRadio" value="Agree"/></td> <td class="cell_radio"><input type="radio" name="ProblemsRadio" value="Does Not Apply"/></td> <td class="cell_radio"><input type="radio" name="ProblemsRadio" value="Disagree"/></td> <td class="cell_radio"><input type="radio" name="ProblemsRadio" value="Strongly Disagree"/></td> </tr> <tr bgcolor="#d8bbdf"> <td class="cell_left">company offers good value for the price paid</td> <td class="cell_radio"><input type="radio" name="ValueRadio" value="Strongly Agree"/></td> <td class="cell_radio"><input type="radio" name="ValueRadio" value="Agree"/></td> <td class="cell_radio"><input type="radio" name="ValueRadio" value="Does Not Apply"/></td> <td class="cell_radio"><input type="radio" name="ValueRadio" value="Disagree"/></td> <td class="cell_radio"><input type="radio" name="ValueRadio" value="Strongly Disagree"/></td> </tr> <tr> <td class="cell_left">company services are easy to use</td> <td class="cell_radio"><input type="radio" name="ServicesRadio" value="Strongly Agree"/></td> <td class="cell_radio"><input type="radio" name="ServicesRadio" value="Agree"/></td> <td class="cell_radio"><input type="radio" name="ServicesRadio" value="Does Not Apply"/></td> <td class="cell_radio"><input type="radio" name="ServicesRadio" value="Disagree"/></td> <td class="cell_radio"><input type="radio" name="ServicesRadio" value="Strongly Disagree"/></td> </tr> <tr bgcolor="#d8bbdf"> <td class="cell_left">company billing is accurate</td> <td class="cell_radio"><input type="radio" name="BillingRadio" value="Strongly Agree"/></td> <td class="cell_radio"><input type="radio" name="BillingRadio" value="Agree"/></td> <td class="cell_radio"><input type="radio" name="BillingRadio" value="Does Not Apply"/></td> <td class="cell_radio"><input type="radio" name="BillingRadio" value="Disagree"/></td> <td class="cell_radio"><input type="radio" name="BillingRadio" value="Strongly Disagree"/></td> </tr> <tr> <td class="cell_left">company credit terms are clear</td> <td class="cell_radio"><input type="radio" name="CreditRadio" value="Strongly Agree"/></td> <td class="cell_radio"><input type="radio" name="CreditRadio" value="Agree"/></td> <td class="cell_radio"><input type="radio" name="CreditRadio" value="Does Not Apply"/></td> <td class="cell_radio"><input type="radio" name="CreditRadio" value="Disagree"/></td> <td class="cell_radio"><input type="radio" name="CreditRadio" value="Strongly Disagree"/></td> </tr> <tr bgcolor="#d8bbdf"> <td class="cell_left">I enjoy doing business with company</td> <td class="cell_radio"><input type="radio" name="EnjoyRadio" value="Strongly Agree"/></td> <td class="cell_radio"><input type="radio" name="EnjoyRadio" value="Agree"/></td> <td class="cell_radio"><input type="radio" name="EnjoyRadio" value="Does Not Apply"/></td> <td class="cell_radio"><input type="radio" name="EnjoyRadio" value="Disagree"/></td> <td class="cell_radio"><input type="radio" name="EnjoyRadio" value="Strongly Disagree"/></td> </tr> </table> </div> <div id="contact"> Your title:<font class="required">*</font> </div> <div id="contact_text"><input type="text" name="Title" size="30" /></div> <br /> <br /> <div id="contact"> Your company size:<font class="required">*</font> </div> <div id="contact_text"> <select name="CompanySize"> <option value="no value">Choose one...</option> <option value="1-49">1 - 49</option> <option value="50-99">50 - 99</option> <option value="100-199">100 - 199</option> <option value="200-499">200 - 499</option> <option value="500-999">500 - 999</option> <option value="1000 or more">1000 or more</option> </select> </div> <br /> <br /> <div id="contact"> Number of company locations:<font class="required">*</font> </div> <div id="contact_text"><input type="text" name="OfficeLocationsNum" size="30" /></div> <br /> <br /> <div id="sq"> What can we do to improve our relationship with you? <br /> <div id="textarea"> <textarea name="ImproveOurRelationship" rows="4" cols="60"></textarea> </div> Do you have any additional comments regarding your experience with Connex? <br /> <div id="textarea"> <textarea name="AdditionalComments" rows="4" cols="60"></textarea> </div> <input type="checkbox" name="check[]" value="contact me" /> I have more to say, and would like to be contacted. <div id="textarea"> The best time to call is between: <input type="text" name="ContactTime1" size="10" /> and <input type="text" name="ContactTime2" size="10" /> <br /> <br /> </div> <div class="ampm">Please be sure to indicate AM or PM and your local time zone.</div> </div> <div id="submit"> <input type="button" value="Send" name="B1" onclick="javascript:validateForm()" /> Fields marked with a <font size="+2" color="#597cce">*</font> are required</div> </div> </div> <div id="footer"> </div> </form> <script language="JavaScript" type="text/javascript"><!-- function validateForm(phpformmailer) { var okSoFar=true with (document.phpformmailer) { var foundAt = Email.value.indexOf("@",0) if (foundAt < 1 && okSoFar) { okSoFar = false alert ("Please enter a valid email address.") Email.focus() } var e1 = Email.value var e2 = Email2.value if (!(e1==e2) && okSoFar) { okSoFar = false alert ("The email addresses you entered do not match. Please re-enter.") Email.focus() } if (FirstName.value=="" && okSoFar) { okSoFar=false alert("Please enter your first name.") FirstName.focus() } if (LastName.value=="" && okSoFar) { okSoFar=false alert("Please enter your last name.") LastName.focus() } if (TelephoneNumber.value=="" && okSoFar) { okSoFar=false alert("Please enter your telephone number.") TelephoneNumber.focus() } if (Title.value=="" && okSoFar) { okSoFar=false alert("Please enter your title.") Title.focus() } if (OfficeLocationsNum.value=="" && okSoFar) { okSoFar=false alert("Please enter your company's number of locations.") OfficeLocationsNum.focus() } if (okSoFar==true) submit(); } } // --></script> </body> </html>
Just in case, here's the CSS:
css Syntax (Toggle Plain Text)
@charset "utf-8"; /* CSS Document */ body { /* <----Gives 1em value of 10px----> */ font-size: 62.5%; } body, html { /* <----IE centering hack----> */ text-align:center; } /* page style */ #banner { background-image:url(banner.jpg); background-position:left; background-position:top; background-repeat:no-repeat; min-height:114px; max-width:732px; } .hidden { display:none; } #wrapper { height:100%; width:750px; min-width:732px; max-width:732px; margin:0 auto; text-align:left; } /* end page style */ /* page head style */ .header { font-family:Tahoma; color:#64077a; font-size:2em; font-weight:bold; } .header2 { font-family:Tahoma; color:#995ca7; font-size:1.4em; font-weight:bold; } /* end page head style */ /* contact info style */ #contact { font-family:Arial, Helvetica, sans-serif; font-size:1.5em; float:left; width:35%; padding-bottom:.6em; padding-top:.2em; clear:left; } #contact_text { float:right; width:65%; padding-bottom:.6em; padding-top:.1em; clear:right; } /* end contact info style */ /* table style */ #tablepos { clear:both; padding-top:2em; padding-bottom:2.6em; } .table_head { font-family:Tahoma; font-size:1em; font-weight:bold; color:#FFFFFF; text-align:center; } .cell_left { font-family:Arial, Helvetica, sans-serif; font-size:1.2em; text-align:left; } .cell_radio { text-align:center; } /* end table style */ /* survey questions style */ #sq { font-family:Arial, Helvetica, sans-serif; font-size:1.5em; padding-top:2em; } #textarea { padding-left:1em; padding-top:1em; padding-bottom:1em; } .ampm { font-family:Tahoma; color:#64077a; font-size:.7em; font-weight:bold; } /* end survey questions style */ #submit { text-align:right; font-family:Tahoma; color:#995ca7; font-size:1em; font-weight:bold; } .required { font-family:Tahoma; color:#597cce; font-weight:bold; }
And finally, the PHP:
php Syntax (Toggle Plain Text)
<?php $replyemail="email@email.com"; $subject="Customer Experience Survey"; $valid_ref1="http://formmailer/survey.html";
