By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,340 Members | 1,642 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,340 IT Pros & Developers. It's quick & easy.

The php form redirect to the next page when click at the javascript calendar

P: 17
can someone help me by telling me why is that whenever i click the javascript calendar, it redirect me to another page eventhough i still do not finish fill the form?

here is the code:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3. session_start();
  4.  
  5. $_SESSION['checkin']=$checkin;
  6. $_SESSION['checkout']=$checkout;
  7. $_SESSION['rooms']=$rooms;
  8. $_SESSION['adults']=$adults;
  9. $_SESSION['children']=$children;
  10.  
  11. ?> 
  12.  
  13. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  14. <html xmlns="http://www.w3.org/1999/xhtml">
  15. <head>
  16. <link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-1.css" title="win2k-cold-1" />
  17. <script type="text/javascript" src="Kalendar/calendar.js"></script>
  18. <script type="text/javascript" src="Kalendar/calendar-en.js"></script>
  19. <script type="text/javascript" src="Kalendar/calendar-setup.js"></script>
  20. <script type="text/javascript" src="Kalendar/ew.js"></script>
  21. <script type="text/javascript"></script>
  22. <title>SistemAPOS</title>
  23. <style type="text/css">
  24. <!--
  25. .style7 {color: #FFFFFF}
  26. .style8 {
  27.     color: #000000;
  28.     font-weight: bold;
  29. }
  30. .style10 {color: #FFFFFF; font-weight: bold; }
  31. .style11 {font-weight: bold}
  32. -->
  33. </style>
  34.  
  35. </head>
  36.  
  37. <body>
  38.  
  39. <form action="findroom.php" method="post">
  40.  
  41.   <p>Check Room Availability</p>
  42.   <p>Check In
  43.     <label>
  44.       <input type="text" name="checkin" value="<?php $checkin ?>"/>
  45.       <input name="datein" type="image" id="dateA" src="Kalendar/ew_calendar.gif" width="16" height="15" border="0" />
  46.   <script type="text/javascript">
  47.                     </script>
  48.             </strong>
  49.   <script type="text/javascript">Calendar.setup(
  50.                     {
  51.                         inputField : "datein", // ID of the input field
  52.                         ifFormat : "%Y-%m-%d", // the date format
  53.                         button : "dateA" // ID of the button
  54.                     }
  55.                     );
  56.                     document.write(ifFormat);
  57.                     </script>
  58.       </label>
  59.   </p>
  60.   <p>Check Out 
  61.     <input name="checkout" type="text" id="checkout" value="<?php $checkout ?>"/>
  62.     <input name="dateout" type="image" id="dateB" src="Kalendar/ew_calendar.gif" width="16" height="15" border="0" />
  63.     </strong>
  64.     <script type="text/javascript">Calendar.setup(
  65.                     {
  66.                         inputField : "dateout", // ID of the input field
  67.                         ifFormat : "%Y-%m-%d", // the date format
  68.                         button : "dateB" // ID of the button
  69.                     }
  70.                     );
  71.                     document.write(ifFormat);
  72.                     </script>
  73.   </p>
  74.   <p>Rooms : 
  75.     <label>
  76.     <select name="rooms" id="rooms" value="<?php $rooms;?>">
  77.       <option>1</option>
  78.       <option>2</option>
  79.       <option>3</option>
  80.       <option>4</option>
  81.       <option>5</option>
  82.     </select>
  83.     </label>
  84.   Adults Per Room : 
  85.   <label>
  86.   <select name="adults" id="adults" value="<?php $adults;?>">
  87.     <option value="1">1</option>
  88.     <option value="2">2</option>
  89.     <option value="3">3</option>
  90.     <option value="4">4</option>
  91.     <option value="5">5</option>
  92.   </select>
  93.   </label>
  94.   Children Per Room : 
  95.   <label>
  96.   <select name="children" id="children" value="<?php $children;?>">
  97.     <option value="1">1</option>
  98.     <option value="2">2</option>
  99.     <option value="3">3</option>
  100.     <option value="4">4</option>
  101.     <option value="5">5</option>
  102.   </select>
  103.   </label>
  104.   </p>
  105.   <p>
  106.     <label>
  107.       <input type="submit" name="Check" id="Check" value="Submit" />
  108.     </label>
  109.   </p>
  110. </form>
  111. </body>
  112. </html>
  113.  
  114.  
  115.  
Mar 20 '10 #1
Share this Question
Share on Google+
1 Reply


P: 67
Hello,

Replace <form action="findroom.php" method="post">
With <form name="form1" action="" method="post">

Thanks & Regards,
Mayur Bhayani
Mar 30 '10 #2

Post your reply

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