473,230 Members | 1,425 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

php form not working with IE

Have a form that works with FF, Chrome but not working with any version of IE.

http://www.tetonvillagesports.net/reso.htm

the contact.php script is as follows:

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. /* Set e-mail recipient */
  3. $myemail  = "rentals@example.com";
  4.  
  5.  
  6. /* Check all form inputs using check_input function */
  7. $group = check_input($_POST['group']);
  8. $yourname = check_input($_POST['yourname']);
  9. $address = check_input($_POST['address']);
  10. $city = check_input($_POST['city']);
  11. $state = check_input($_POST['state']);
  12. $zip = check_input($_POST['zip']);
  13. $phone = check_input($_POST['phone']);
  14. $email = check_input($_POST['email'], "Enter your email address");
  15. $arrival_date = check_input($_POST['arrival_date']);
  16. $departure_date = check_input($_POST['departure_date']);
  17. $local_lodging = check_input($_POST['local_lodging']);
  18. $num_days = check_input($_POST['num_days']);
  19. $name1 = check_input($_POST['name1']);
  20. $age1 = check_input($_POST['age1']);
  21. $height1 = check_input($_POST['height1']);
  22. $weight1 = check_input($_POST['weight1']);
  23. $sport_equip1 = check_input($_POST['1sport_equi1p']);
  24. $sport_ski_size1 = check_input($_POST['sport_ski_size1']);
  25. $demo_equip1 = check_input($_POST['demo_equip1']);
  26. $demo_ski_model1 = check_input($_POST['demo_ski_model1']);
  27. $demo_ski_size1 = check_input($_POST['demo_ski_size1']);
  28. $shoe_size1 = check_input($_POST['shoe_size1']);
  29. $board_equip1 = check_input($_POST['board_equip1']);
  30. $board_size1 = check_input($_POST['board_size1']);
  31. $jr_equip1 = check_input($_POST['jr_equip1']);
  32. $jr_ski_size1 = check_input($_POST['jr_ski_size1']);
  33. $skier_type1 = check_input($_POST['skier_type1']);
  34. $comment1 = check_input($_POST['comment1']);
  35. $name2 = check_input($_POST['name2']);
  36. $age2 = check_input($_POST['age2']);
  37. $height2 = check_input($_POST['height2']);
  38. $weight2 = check_input($_POST['weight2']);
  39. $sport_equip2 = check_input($_POST['sport_equip2']);
  40. $sport_ski_size2 = check_input($_POST['sport_ski_size2']);
  41. $demo_equip2 = check_input($_POST['demo_equip2']);
  42. $demo_ski_model2 = check_input($_POST['demo_ski_model2']);
  43. $demo_ski_size2 = check_input($_POST['demo_ski_size2']);
  44. $shoe_size2 = check_input($_POST['shoe_size2']);
  45. $board_equip2 = check_input($_POST['board_equip2']);
  46. $board_size2 = check_input($_POST['board_size2']);
  47. $jr_equip2 = check_input($_POST['jr_equip2']);
  48. $jr_ski_size2 = check_input($_POST['jr_ski_size2']);
  49. $skier_type2 = check_input($_POST['skier_type2']);
  50. $comment2 = check_input($_POST['comment2']);
  51. $name3 = check_input($_POST['name3']);
  52. $age3 = check_input($_POST['age3']);
  53. $height3 = check_input($_POST['height3']);
  54. $weight3 = check_input($_POST['weight3']);
  55. $sport_equip3 = check_input($_POST['sport_equip3']);
  56. $sport_ski_size3 = check_input($_POST['sport_ski_size3']);
  57. $demo_equip3 = check_input($_POST['demo_equip3']);
  58. $demo_ski_model3 = check_input($_POST['demo_ski_model3']);
  59. $demo_ski_size3 = check_input($_POST['demo_ski_size3']);
  60. $shoe_size3 = check_input($_POST['shoe_size3']);
  61. $board_equip3 = check_input($_POST['board_equip3']);
  62. $board_size3 = check_input($_POST['board_size3']);
  63. $jr_equip3 = check_input($_POST['jr_equip3']);
  64. $jr_ski_size3 = check_input($_POST['jr_ski_size3']);
  65. $skier_type3 = check_input($_POST['skier_type3']);
  66. $comment3 = check_input($_POST['comment3']);
  67. $name4 = check_input($_POST['name4']);
  68. $age4 = check_input($_POST['age4']);
  69. $height4 = check_input($_POST['height4']);
  70. $weight4 = check_input($_POST['weight4']);
  71. $sport_equip4 = check_input($_POST['sport_equip4']);
  72. $sport_ski_size4 = check_input($_POST['sport_ski_size4']);
  73. $demo_equip4 = check_input($_POST['demo_equip4']);
  74. $demo_ski_model4 = check_input($_POST['demo_ski_model4']);
  75. $demo_ski_size4 = check_input($_POST['demo_ski_size4']);
  76. $shoe_size4 = check_input($_POST['shoe_size4']);
  77. $board_equip4 = check_input($_POST['board_equip4']);
  78. $board_size4 = check_input($_POST['board_size4']);
  79. $jr_equip4 = check_input($_POST['jr_equip4']);
  80. $jr_ski_size4 = check_input($_POST['jr_ski_size4']);
  81. $skier_type4 = check_input($_POST['skier_type4']);
  82. $comment4 = check_input($_POST['comment4']);
  83.  
  84.  
  85. /* If e-mail is not valid show error message */
  86. if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/", $email))
  87. {
  88.     show_error("E-mail address not valid");
  89. }
  90.  
  91.  
  92. /* Let's prepare the message for the e-mail */
  93. $message = "What is up your rentalness!
  94.  
  95. Everybody wants some, this person wants some too:
  96. _______________________________________
  97. Group Name: $group
  98.  
  99. Name: $yourname
  100. Contact Address: $address
  101. City: $city
  102. State: $state
  103. Zip Code: $zip
  104. Daytime Phone:  $phone
  105. Contact E-mail: $email
  106. Arrival Date: $arrival_date
  107. Departure Date: $departure_date
  108. Local Accomodations: $local_lodging
  109. Number of days skiing: $num_days
  110. __________________________________________
  111. RENTER #1
  112.    Name: $name1
  113.    Birth Date:  $age1
  114.    Height (ft/in): $height1
  115.    Weight (lbs): $weight1
  116. SPORT EQUIPMENT
  117.    Package Type: $sport_equip1
  118.    Sport Ski Size: $sport_ski_size1
  119.    Shoe size: $shoe_size1
  120. DEMO SKIS
  121.    Package Type: $demo_equip1
  122.    Demo ski model: $demo_ski_model1
  123.    Demo Ski size: $demo_ski_size1
  124.    Shoe size: $shoe_size1
  125. SNOWBOARD
  126.    Package Type: $board_equip1
  127.    Board size: $board_size1
  128.    Shoe size: $shoe_size1
  129. KID'S EQUIPMENT (12 and under)
  130.    Junior Pakage: $jr_equip1
  131.    Ski Length: $jr_ski_size1
  132.    Shoe size: $shoe_size1
  133. Skier Type: $skier_type1
  134. Comments: $comment1
  135. ___________________________________
  136. RENTER #2
  137.    Name: $name2
  138.    Birth Date:  $age2
  139.    Height (ft/in): $height2
  140.    Weight (lbs): $weight2
  141. SPORT EQUIPMENT
  142.    Package Type: $sport_equip2
  143.    Sport Ski Size: $sport_ski_size2
  144.    Shoe size: $shoe_size2
  145. DEMO SKIS
  146.    Package Type: $demo_equip2
  147.    Demo ski model: $demo_ski_model2
  148.    Demo Ski size: $demo_ski_size2
  149.    Shoe size: $shoe_size2
  150. SNOWBOARD
  151.    Package Type: $board_equip2
  152.    Board size: $board_size2
  153.    Shoe size: $shoe_size2
  154. KID'S EQUIPMENT (1 and under)
  155.    Junior Pakage: $jr_equip2
  156.    Ski Length: $jr_ski_size2
  157.    Shoe size: $shoe_size2
  158. Skier Type: $skier_type2
  159. Comments: $comment2
  160. ________________________________________
  161. RENTER #3
  162.    Name: $name3
  163.    Birth Date:  $age3
  164.    Height (ft/in): $height3
  165.    Weight (lbs): $weight3
  166. SPORT EQUIPMENT
  167.    Package Type: $sport_equip3
  168.    Sport Ski Size: $sport_ski_size3
  169.    Shoe size: $shoe_size3
  170. DEMO SKIS
  171.    Package Type: $demo_equip3
  172.    Demo ski model: $demo_ski_model3
  173.    Demo Ski size: $demo_ski_size3
  174.    Shoe size: $shoe_size3
  175. SNOWBOARD
  176.    Package Type: $board_equip3
  177.    Board size: $board_size3
  178.    Shoe size: $shoe_size3
  179. KID'S EQUIPMENT (12 and under)
  180.    Junior Pakage: $jr_equip3
  181.    Ski Length: $jr_ski_size3
  182.    Shoe size: $shoe_size3
  183. Skier Type: $skier_type3
  184. Comments: $comment3
  185. _____________________________
  186. RENTER #4
  187.    Name: $name4
  188.    Birth Date:  $age4
  189.    Height (ft/in): $height4
  190.    Weight (lbs): $weight4
  191. SPORT EQUIPMENT
  192.    Package Type: $sport_equip4
  193.    Sport Ski Size: $sport_ski_size4
  194.    Shoe size: $shoe_size4
  195. DEMO SKIS
  196.    Package Type: $demo_equip4
  197.    Demo ski model: $demo_ski_model4
  198.    Demo Ski size: $demo_ski_size4
  199.    Shoe size: $shoe_size4
  200. SNOWBOARD
  201.    Package Type: $board_equip4
  202.    Board size: $board_size4
  203.    Shoe size: $shoe_size4
  204. KID'S EQUIPMENT (12 and under)
  205.    Junior Pakage: $jr_equip4
  206.    Ski Length: $jr_ski_size4
  207.    Shoe size: $shoe_size4
  208. Skier Type: $skier_type4
  209. Comments: $comment4
  210.  
  211.  
  212. End of message
  213. ";
  214.  
  215. $subject = "Rental Reservation";
  216.  
  217. /* Send the message using mail() function */
  218. mail($myemail, $subject, $message);
  219.  
  220. /* Redirect visitor to the thank you page */
  221. header('Location: http://www.tetonvillagesports.com/thanks.html');
  222. exit();
  223.  
  224. /* Functions we used */
  225. function check_input($data, $problem='')
  226. {
  227.     $data = trim($data);
  228.     $data = stripslashes($data);
  229.     $data = htmlspecialchars($data);
  230.     if ($problem && strlen($data) == 0)
  231.     {
  232.         show_error($problem);
  233.     }
  234.     return $data;
  235. }
  236.  
  237. function show_error($myError)
  238. {
  239. ?>
  240.     <html>
  241.     <body>
  242.  
  243.     <b>Please correct the following error:</b><br />
  244.     <?php echo $myError; ?>
  245.  
  246.     </body>
  247.     </html>
  248. <?php
  249. exit();
  250. }
  251. ?>


Any thoughts would be appreciated
Dec 22 '09 #1
4 3372
Never mind I figured it out.
Dec 22 '09 #2
Atli
5,058 Expert 4TB
Hey.

How exactly is it now working? Can you elaborate on that please.

It would also help to see the HTML form (or a part of it, at least) that triggers this code. Since this is a browser issue, the problem is most likely not in the PHP code, but rather in the HTML form.


Also, since you have a LOT of input fields that you need to check...
Rather than type them out like that, manually writing each one into the check_input function and creating a global variable for each of them, you might want to try a more dynamic way, using arrays:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // Set up a list of fields and their respective problem texts.
  3. $fields = array(
  4.     'name' => 'Enter a valid name!',
  5.     'email' => 'Your email address is invalid!',
  6.     'field3' => '',
  7.     'etc...' => ''
  8. );
  9.  
  10. // An array to hold the data for the fields.
  11. $data = array();
  12.  
  13. // Go through the field list and check the input for each of them.
  14. foreach($fields as $_name => $_problem) {
  15.     $data[$_name] = check_input($_POST[$_name], $_problem);
  16. }
  17.  
  18. // Do something with the data
  19. $text = <<<TEXT
  20. Some string that you would inject the data into:
  21. Name: {$data['name']}
  22. Email: {$data['email']}
  23. Field3: {$data['field3']}
  24. TEXT;
  25. ?>
This way you don't have to manually use the function for each field, and it's a little more organized. You could even pull the field list from another source. (Not that that's necessarily a good idea :P)

And by using the $data array like that, you don't clutter the global scope with random variables, which is good. (Keeping the global scope clear is always best)
Dec 22 '09 #3
Thanks for the input, I appreciate the help. The form is located at

http://www.tetonvillagesports.com/rentreso.html

The problem was resolved after I finally realized the Submit button was outside of the form tags. Everything (other than terrible coding) is now going great.
Dec 22 '09 #4
Atli
5,058 Expert 4TB
Glad to hear that.
It always seems that these sort of minor oversights cause the biggest problems :)
Dec 23 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
8
by: CJack | last post by:
hy, I have an mdi application, i create a child form and I want to know when a button is pressed while that child form is loaded. I have this code: private void frmTestBaby_KeyUp(object sender,...
4
by: Michael | last post by:
Hi Everyone, I'm hoping someone out there can give me some guidance. I'm currenlty using VS2005 and the other day the Form Wizzard stopped working. What I mean, is that the wizzard no longer...
14
by: Galen Somerville | last post by:
My current screen resolution is set to 1024 x 768. My form size always comes up as 1032 x 748. I have tried the help sample ' Retrieve the working rectangle from the Screen class ' using the...
13
by: deko | last post by:
I have a basic feedback form with a submit button. After the "send" button is clicked, I want the user to be redirected to a different page that says "Your message has been sent." How do I do...
6
by: Harshpandya | last post by:
Hi all, I am working on the form in which you fill out the whole PHP form and e mail that details to someone. It is working fine. But now i want to send the same form to be sent to different...
0
by: asad56 | last post by:
I am workin with a superstore managment project. I connect Access database with main form . Then it work properly. But now I connect same database with another table or field in another form which is...
7
by: Jwe | last post by:
Hi, I've written a program which has both a command line interface and Windows form interface, however it isn't quite working correctly. When run from command line with no arguments it should...
11
by: Twayne | last post by:
Hi, Newbie to PHP here, no C or other relevant background, so pretty niave w/r to the nuances etc. but I think this is pretty basic. XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.