richyp Posted January 31, 2010 Share Posted January 31, 2010 Hi Everyone, I have built my first website and it has a basic booking form on it which only half works! When i test it, the information that is emailed back is fine from all the text boxes (Name/email/telephone/comments) but the radio buttons and drop-down box give me nothing - it's just blank!? Try as i might i just can't get my head around it. I used a code generator to come up with the form and then modified it to include the radio buttons etc. I would be so grateful if someone could take a look and see if they have an idea what might be going on. Here's the HTML: <div id = "ctable"> <form action="Booking.php" method="post"> <table width="615" border="0" cellpadding="8" cellspacing="8" summary="feedback form"> <tr><td width="169"><label for="tswname"><span class="style23">Name</span></label> </td><td colspan="4"><input type="text" name="fullname" id="tswname" size="55" /></td></tr> <tr><td height="49"><label for="tswemail">Email address</label>:</td><td colspan="4"><input type="text" id="tswemail" name="email" size="55" /></td></tr> <tr><td><label for="tswtele">Telephone Number</label>:</td><td colspan="4"><input type= "text" id="tswtele" name="tele" size="55" /></td></tr> <tr> <td width="169">Please select a day for your mock interview</td> <td width="107" height="34"><label for="tswthis"><input type="radio" name="radio" id="tswthis" value="this" /> This week</label></td> <td width="101"> <label for="next"><input type="radio" name="radio" id="tswnext" value="next" /> </label> Next week</td> <td width="134"><label for="tswday"><select name="Day Of The Week" id="select2"> <option>Monday </option> <option>Tuesday</option> <option>Wednesday</option> <option>Thursday</option> <option>Friday</option> <option>Saturday</option> <option>Sunday</option> </select></label></td> </tr> <tr> <td width="169"><span class="style24"><span class="style23">Please select your time</span></span><span class="style25"> <br /> (currently limited availability due to Graduate season</span><span class="style24">)</span></td> <td colspan="4"><label for="tswselect"> <select name="select" id="select"> <option>(weekend) 11:00 - 11:30</option> <option selected="selected">(weekend) 13:00 - 13:30</option> <option>(weekend) 14:00 - 14:30</option> <option>17:30 - 18:00</option> <option>18:00 - 18:30</option> <option>18:30 - 19:00</option> <option>19:00 - 19:30</option> <option>19:30 - 20:00</option> </select> </label></td> </tr> <p> <td colspan="5"> <label for="tswcomments">Name and description of role you are applying for</label> <br /> <span class="style24">(The more information you can provide the better)</span><br /> <textarea rows="15" cols="75" name="comments" id="tswcomments"></textarea> </p></td> </tr> <tr> <td align="center" colspan="5"> <input type="submit" value="Send Booking Form" /><br /></td> </tr> </table> </form> </div> and here is the PHP form: <?php // ------------- CONFIGURABLE SECTION ------------------------ // $mailto - set to the email address you want the form // sent to, eg //$mailto = "[email protected]" ; $mailto = '[email protected]' ; // $subject - set to the Subject line of the email, eg //$subject = "Feedback Form" ; $subject = "Booking Form" ; // the pages to be displayed, eg //$formurl = "http://www.example.com/feedback.html" ; //$errorurl = "http://www.example.com/error.html" ; //$thankyouurl = "http://www.example.com/thankyou.html" ; $formurl = "http://www.mywebsite.co.uk/contact.html" ; $errorurl = "http://www.mywebsite.co.uk/error.html" ; $thankyouurl = "http://www.mywebsite.co.uk/thankyou.html" ; $email_is_required = 1; $name_is_required = 1; $comments_is_required = 1; $time_is_required = 1; $day_is_required = 1; $this_is_required = 1; $next_is_required = 1; $tele_is_required = 1; $uself = 0; $use_envsender = 0; $use_sendmailfrom = 0; $use_webmaster_email_for_from = 0; $use_utf8 = 1; $my_recaptcha_private_key = '' ; // -------------------- END OF CONFIGURABLE SECTION --------------- $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $content_type = (!isset( $use_utf8 ) || ($use_utf8 == 0)) ? 'Content-Type: text/plain; charset="iso-8859-1"' : 'Content-Type: text/plain; charset="utf-8"' ; if (!isset( $use_envsender )) { $use_envsender = 0 ; } if (isset( $use_sendmailfrom ) && $use_sendmailfrom) { ini_set( 'sendmail_from', $mailto ); } $envsender = "-f$mailto" ; $fullname = (isset($_POST['fullname']))? $_POST['fullname'] : $_POST['name'] ; $email = $_POST['email'] ; $comments = $_POST['comments'] ; $select = $_POST['time'] ; $day = $_POST['day'] ; $next = $_POST['next'] ; $tele = $_POST['tele'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (($email_is_required && (empty($email) || !preg_match('/@/', $email))) || ($name_is_required && empty($fullname)) || ($comments_is_required && empty($comments))) { header( "Location: $errorurl" ); exit ; } if ( preg_match( "/[\r\n]/", $fullname ) || preg_match( "/[\r\n]/", $email ) ) { header( "Location: $errorurl" ); exit ; } if (strlen( $my_recaptcha_private_key )) { require_once( 'recaptchalib.php' ); $resp = recaptcha_check_answer ( $my_recaptcha_private_key, $_SERVER['REMOTE_ADDR'], $_POST['recaptcha_challenge_field'], $_POST['recaptcha_response_field'] ); if (!$resp->is_valid) { header( "Location: $errorurl" ); exit ; } } if (empty($email)) { $email = $mailto ; } $fromemail = (!isset( $use_webmaster_email_for_from ) || ($use_webmaster_email_for_from == 0)) ? $email : $mailto ; if (function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Name of sender: $fullname\n" . "Email of sender: $email\n" . "Telephone number of sender: $tele\n" . "Would like an interview: $this\n" . "Would like an interview: $next\n" . "at: $select\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ; $headers = "From: \"$fullname\" <$fromemail>" . $headersep . "Reply-To: \"$fullname\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.15.0" . $headersep . 'MIME-Version: 1.0' . $headersep . $content_type ; if ($use_envsender) { mail($mailto, $subject, $messageproper, $headers, $envsender ); } else { mail($mailto, $subject, $messageproper, $headers ); } header( "Location: $thankyouurl" ); exit ; ?> Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/190420-my-first-booking-form-am-i-missing-something-obvious/ Share on other sites More sharing options...
teamatomic Posted January 31, 2010 Share Posted January 31, 2010 Your drop down has a name of select yet I see no POST['select'] same for the radio button. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/190420-my-first-booking-form-am-i-missing-something-obvious/#findComment-1004480 Share on other sites More sharing options...
richyp Posted January 31, 2010 Author Share Posted January 31, 2010 Yes you're right - problem solved! I have just this second finished testing it again and it all works now. Thanks for giving a very frustrated newbie a helping hand. Link to comment https://forums.phpfreaks.com/topic/190420-my-first-booking-form-am-i-missing-something-obvious/#findComment-1004649 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.