abigailhamilton Posted January 7, 2011 Share Posted January 7, 2011 Aloha, friends! I have a contact form page with 2 separate contact forms on it, and it is not displaying or acting as intended. The page is live at http://fairmontolympiccatering.com/contact-fairmont-olympic-seattle.php. The problems are: [*]The Thank you message does not display when a form is submitted [*]The form is not being returned to my email address [*]In the past when the form was being returned to my email address, the content was blank (input not fcaptured/delivered) I am desperate to get this fixed, as my client has a big event coming up FAST. So, I am hoping a kind PHP expert can help me fix what's wrong. Quote Link to comment https://forums.phpfreaks.com/topic/223694-help-with-a-contact-form-that-is-not-working-properly/ Share on other sites More sharing options...
Pikachu2000 Posted January 7, 2011 Share Posted January 7, 2011 You'll need to post the actual relevant code. There's not really any way to tell what's wrong by looking at the website. Quote Link to comment https://forums.phpfreaks.com/topic/223694-help-with-a-contact-form-that-is-not-working-properly/#findComment-1156296 Share on other sites More sharing options...
abigailhamilton Posted January 7, 2011 Author Share Posted January 7, 2011 Erp. I thought using dev tools would be easier, sorry! Here is the relevant code for the page with the 2 forms: <?php /*echo '<pre>'; print_r($HTTP_POST_VARS); echo '</pre>';*/ $err = 0; if ($HTTP_POST_VARS['Submit']) { $email = $HTTP_POST_VARS['Email']; $name = $HTTP_POST_VARS['Name']; $company = $HTTP_POST_VARS['Company']; $mailingaddress = $HTTP_POST_VARS['Address']; $mailingcsz = $HTTP_POST_VARS['CSZ']; $phone = $HTTP_POST_VARS['Phone']; $comments = $HTTP_POST_VARS['Comments']; $drinks = $HTTP_POST_VARS['Drinks']; $altphone = $HTTP_POST_VARS['Alternate_Phone_']; $numberofguests = $HTTP_POST_VARS['Number_of_Guests']; $dateofevent = $HTTP_POST_VARS ['Date_of_Event']; $durationofevent = $HTTP_POST_VARS ['Duration_of_Event']; $eventtype = $HTTP_POST_VARS['Event_Type']; $cateringtype = $HTTP_POST_VARS['Catering_Type']; $site = $HTTP_POST_VARS['Site']; $source = $HTTP_POST_VARS['Source']; $commentquestion = $HTTP_POST_VARS['Question']; $tour = $HTTP_POST_VARS['Tour']; $quote = $HTTP_POST_VARS['Quote']; if ( strlen($name)<3 || strlen($numberofguests)<1 || strlen($email)<5) { $err=1; } } elseif ($HTTP_POST_VARS['Submit2']) { $name = $HTTP_POST_VARS['Name2']; $company = $HTTP_POST_VARS['Company2']; $email = $HTTP_POST_VARS['Email2']; $question = $HTTP_POST_VARS['Question']; if ( strlen($name)<3 || strlen($question)<1 || strlen($email)<5) { $err=1; } } //$mailto = "Dana.Schroader@fairmont.com, dana@ah.candyhog.com"; $mailto = 'dana@ah.candyhog.com'; $mailsubj = "Fairmont Olympic Catering Quote Request"; $mailhead = "From: $email\n"; if (!$err && $HTTP_POST_VARS) { reset ($HTTP_POST_VARS); $mailbody = "A visitor has submitted a quote request, comment, or question.:\n"; while (list ($key, $val) = each ($HTTP_POST_VARS)) { if(!empty($val) && $key !='Submit' && $key != 'Submit2') { if ($key == 'Name2') { $key = 'Name'; } if ($key == 'Company2') { $key = 'Company'; } if ($key == 'Email2') { $key = 'Email'; } $mailbody .= "$key : $val\n"; } } /// if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); } //print_r($mailbody); mail($mailto, $mailsubj, $mailbody, $mailhead); $email = ''; $name = ''; $phone = ''; $comments = ''; $drinks = ''; $altphone = ''; $numberofguests = ''; $dateofevent = ''; $durationofevent = ''; $company = ''; $eventtype = ''; $cateringtype = ''; $site = ''; $source = ''; $commmentquestion = ''; $tour = ''; $quote = ''; } ?> and <td><!-- TemplateBeginEditable name="h" --> <!-- InstanceBeginEditable name="Contents" --> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <table class="contentrow" width="990" border="0" cellpadding="18" cellspacing="0" style="margin-top: -4px; border-left: 1px; border-left-style: solid; border-left-color: #a6a6a6; border-right: 1px; border-right-style: solid; border-right-color: #a6a6a6;"> <tr> <td align="left" valign="top" style="border-right-style: solid; border-right-width: 1px; border-right-color: #a6a6a6><span class="headline"><span class="headline">Request a quote or a tour of our spaces</span><br /> </span><span class="bodytext">Fill out the form below to tell us a little bit about your event, so we can plan a tour for you or put together a sample quote. You can also call us anytime!</span> <table width="94%" border="0" cellpadding="2" cellspacing="0"> <tr valign="bottom"><td class="bodycopy"><table width="99%" border="0" cellpadding="2" cellspacing="0"> <tr valign="middle"> <td colspan="2" bgcolor="#FFFFFF" class="bodycopy"><p align="center" class="style9 style11"> <?php if (!$err && $HTTP_POST_VARS) { ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <br /> Thank you so much for your tour or quote request. <br /> We will respond to you as soon as we can, and look forward to serving you!<span class="style13"><br /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </span><br /> </p></td> </tr> <?php } else { ?> <tr valign="middle"> <td colspan="2" bgcolor="#FFFFFF" class="bodycopy"><p class="style10"> Please fill out required (*) fields. If you have already tried to submit the form, please check required fields and resubmit. </p></td> </tr> <?php } ?> <tr valign="middle"> <td class="bodytext">I would like a... <label></label></td> <td class="bodytext"><input type="checkbox" name="Tour" id="tour" value="Yes" /> Personal tour of the event spaces </td> </tr> <tr valign="middle"> <td class="bodytext"> </td> <td class="bodytext"><input type="checkbox" name="Quote" id="quote" value="Yes" /> Premliminary quote </label></td> <td> </td> </tr> <tr valign="middle"> <td class="bodytext"><strong>Name</strong> <span class="style16">*</span></td> <td class="bodytext"><input name="Name" type="text" id="Name" size="40" maxlength="80" value="<?php echo $name; ?>"/></td> </tr> <tr valign="middle"> <td class="bodytext">Company</td> <td class="bodytext"><input name="Company" type="text" id="Company" size="40" value="<?php echo $company; ?>"/> </td> </tr> <tr valign="middle"> <td class="bodytext">Street address or PO Box</td> <td class="bodytext"><input name="Address" type="text" id="Address" size="40" value="<?php echo $mailingaddress; ?>"/></td> </tr> <tr valign="middle"> <td class="bodytext">City, state, zip</td> <td class="bodytext"><input name="CSZ" type="text" id="CSZ" size="40" value="<?php echo $mailingcsz; ?>"/></td> </tr> <tr valign="middle"> <td class="bodytext"><strong>E-mail</strong> <span class="style16">*</span></td> <td class="bodytext"><input name="Email" type="text" id="Email" size="40" maxlength="80" value="<?php echo $email; ?>" /></td> </tr> <tr valign="middle"> <td class="bodytext"><strong>Phone</strong> <span class="style16">*</span></td> <td class="bodytext"><input name="Phone" type="text" id="Phone" size="12" maxlength="12" value="<?php echo $phone; ?>"/></td> </tr> <tr valign="middle"> <td class="bodytext"> </td> <td class="bodytext">or <input name="Alternate_Phone" type="text" id="Alternate_Phone" maxlength="12" text="<?php echo $altphone; ?>" /> (Alternate)</td> </tr> <tr valign="middle"> <td class="bodytext"><strong>Number of guests</strong> <span class="style16">*</span></td> <td class="bodytext"><input name="Number_of_Guests" type="text" id="Number_of_Guests" size="4" maxlength="80" text="<?php echo $numberofguests; ?>"/></td> </tr> <tr valign="middle"> <td class="bodytext"><strong>Date of event</strong> <span class="style16">*</span></td> <td class="bodytext"><input name="Date_of_Event" type="text" id="Date_of_Event" size="20" maxlength="80" text="<?php echo $dateofevent; ?>"/> (Or general time of year) </td> </tr> <tr valign="middle"> <td class="bodytext"><strong>Duration</strong></td> <td class="bodytext"><input name="Duration_of_Event" type="text" id="Duration_of_Event" size="20" maxlength="80" text="<?php echo $durationofevent; ?>"/> Afternoon? Evening? All day? </td> </tr> <tr valign="middle"> <td class="bodytext"><p><strong>Event</strong><br /> Wedding? Anniversary? Corporate?<br /> Gala?</p></td> <td class="bodytext"><textarea name="Event_Type" cols="40" rows="3" id="Event_Type"><?php echo $eventtype; ?></textarea></td> </tr> <tr valign="middle"> <td class="bodytext"><strong>Type</strong><br /> Buffet? Sit-down? Hors d'oeuvres and drinks? </td> <td class="bodytext"><textarea name="Catering_Type" cols="40" rows="3" id="Catering_Type"><?php echo $cateringtype; ?></textarea></td> </tr> <tr valign="middle"> <td class="bodytext"><strong>Preferred event room</strong><br /></td> <td class="bodytext"><textarea name="Site" cols="40" rows="4" id="Site"><?php echo $site; ?></textarea></td> </tr> <tr valign="bottom"> <td valign="top" class="bodytext"><strong>Comments about food and or theme</strong> <span class="style16">*</span> or any notes you would like to share about what you are envisioning or require</td> <td class="bodytext"><textarea name="Comments" cols="40" rows="10" class="style8" id="Comments"><?php echo $comments; ?></textarea></td> </tr> <tr valign="bottom"> <td valign="top" class="bodytext"><strong>Drinks or bar service</strong> <span class="style16">*</span></td> <td class="bodytext"><textarea name="Drinks" cols="40" rows="8" class="style15" id="Drinks"><?php echo $drinks; ?></textarea></td> </tr> <tr valign="bottom"> <td valign="top" class="bodytext">How did you become interested in the Fairmont Olympic Hotel for your event?</td> <td class="bodytext"><textarea name="Source" cols="40" rows="4" class="style8" id="Comments"><?php echo $source ?></textarea></td> </tr> <tr valign="bottom"> <td valign="middle" class="bodycopy"> </td> <td class="bodycopy"><div align="right"><br /> <input type="submit" name="Submit" value="Submit" /> </div></td> </tr> </table></td> </tr> </table> <p> </p></td> <td align="left" valign="top"> <span align="left" class="headline" style="margin-bottom: -3px;">Send us a question or comment<br /> </span> <table width="94%" border="0" cellpadding="2" cellspacing="0"> <tr valign="bottom"> <td class="bodycopy"><table width="99%" border="0" cellpadding="2" cellspacing="0"> <tr valign="middle"> <td colspan="2" bgcolor="#FFFFFF" class="bodycopy"><p align="center" class="style9 style11"> <?php if (!$err && $HTTP_POST_VARS) { ?> <span class="style13">- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </span><br /> Thank you so much! You have successfully submitted your question or comment. We will respond to you as soon as we can and look forward to serving you!<span class="style13"><br /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - </span><br /> </p></td> </tr> <?php } else { ?> <tr valign="middle"> <td colspan="2" bgcolor="#FFFFFF" class="bodycopy"><p class="style10"> Please fill out required (*) fields. If you have already tried to submit the form, please check required fields and resubmit. </p></td> </tr> <?php } ?> <tr valign="middle"> <td class="bodytext"><strong>Name</strong> <span class="style16">*</span></td> <td class="bodytext"><input name="Name2" type="text" id="Name2" size="39" maxlength="80" value="<?php echo $name; ?>"/></td> </tr> <tr valign="middle"> <td class="bodytext">Company</td> <td class="bodytext"><input name="Company2" type="text" id="Company2" size="39" value="<?php echo $company; ?>"/> </td> </tr> <tr valign="middle"> <td class="bodytext"><strong>E-mail</strong> <span class="style16">*</span></td> <td class="bodytext"><input name="Email2" type="text" id="Email2" size="39" maxlength="80" value="<?php echo $email; ?>" /></td> </tr> <tr valign="bottom"> <td valign="top" class="bodytext"><strong>Comment or question</strong> <span class="style16">*</span></td> <td class="bodytext"><textarea name="Question" cols="40" rows="20" class="style8" id="Question"><?php echo $commentquestion; ?></textarea></td> </tr> <tr valign="bottom"> <td valign="middle" class="bodycopy"> </td> <td class="bodycopy"><div align="right"><br /> <input type="submit" name="Submit2" value="Submit" /> </div></td> </tr> </table></td> </tr> </table> <p align="left" class="headline" style="margin-bottom: -3px;"> </p></td> </tr> </table></form> <!-- InstanceEnd --></html> Quote Link to comment https://forums.phpfreaks.com/topic/223694-help-with-a-contact-form-that-is-not-working-properly/#findComment-1156341 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.