472,973 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

How to show the available time on the day which i select??

52
Hi ,
I stuck in my project as i face a problem
How to show the available time of the venue when i select the day??
Need to connect to the database to find out the available time of the venue on that day i select???


The selection the day
Expand|Select|Wrap|Line Numbers
  1. ?>
  2. <select name="p_day" id="p_day">
  3.   <option <?php if(isset($_COOKIE['Day']) && $_COOKIE['Day']=="Monday") echo "selected"; ?> value="Monday">Monday</option>
  4.   <option <?php if(isset($_COOKIE['Day']) && $_COOKIE['Day']=="Tuesday") echo "selected"; ?> value="Tuesday">Tuesday</option>
  5.   <option <?php if(isset($_COOKIE['Day']) && $_COOKIE['Day']=="Wednesday") echo "selected"; ?> value="Wednesday">Wednesday</option>
  6.   <option <?php if(isset($_COOKIE['Day']) && $_COOKIE['Day']=="Thursday") echo "selected"; ?> value="Thursday">Thursday</option>
  7.   <option <?php if(isset($_COOKIE['Day']) && $_COOKIE['Day']=="Friday") echo "selected"; ?> value="Friday">Friday</option>
  8.   <option <?php if(isset($_COOKIE['Day']) && $_COOKIE['Day']=="Saturday") echo "selected"; ?> value="Saturday">Saturday</option>
  9. </select>
  10.  
This is the selection of the time which i think need to change all the code here!

Expand|Select|Wrap|Line Numbers
  1. ?>
  2. <select name="p_time" id="select7">
  3.   <option <?php if(isset($_COOKIE['Time']) && $_COOKIE['Time']=="0800") echo "selected"; ?> value="0800">0800</option>
  4.   <option <?php if(isset($_COOKIE['Time']) && $_COOKIE['Time']=="0900") echo "selected"; ?> value="0900">0900</option>
  5.   <option <?php if(isset($_COOKIE['Time']) && $_COOKIE['Time']=="1010") echo "selected"; ?> value="1010">1010</option>
  6.   <option <?php if(isset($_COOKIE['Time']) && $_COOKIE['Time']=="1110") echo "selected"; ?> value="1110">1110</option>
  7.   <option <?php if(isset($_COOKIE['Time']) && $_COOKIE['Time']=="1205") echo "selected"; ?> value="1205">1205</option>
  8.   <option <?php if(isset($_COOKIE['Time']) && $_COOKIE['Time']=="1300") echo "selected"; ?> value="1300">1300</option>
  9.   <option <?php if(isset($_COOKIE['Time']) && $_COOKIE['Time']=="1400") echo "selected"; ?> value="1400">1400</option>
  10.   <option <?php if(isset($_COOKIE['Time']) && $_COOKIE['Time']=="1510") echo "selected"; ?> value="1510">1510</option>
  11.   <option <?php if(isset($_COOKIE['Time']) && $_COOKIE['Time']=="1610") echo "selected"; ?> value="1610">1610</option>
  12.   <option <?php if(isset($_COOKIE['Time']) && $_COOKIE['Time']=="1710") echo "selected"; ?> value="1710">1710</option>
  13. </select>
  14.  

This is the selection of the venue
Expand|Select|Wrap|Line Numbers
  1. ?>
  2. <select name="p_venue">
  3. <?php
  4. do {  
  5. ?>
  6.   <option 
  7.   <?php if(isset($_COOKIE['Venue']) && $_COOKIE['Venue']==$row_VenueRS['venue']) echo "selected"; ?>
  8.     value="<?php echo $row_VenueRS['venue']?>"><?php echo $row_VenueRS['venue']?>
  9.   </option>
  10. <?php
  11. } while ($row_VenueRS = mysql_fetch_assoc($VenueRS));
  12.   $rows = mysql_num_rows($VenueRS);
  13.   if($rows > 0) {
  14.   mysql_data_seek($VenueRS, 0);
  15.   $row_VenueRS = mysql_fetch_assoc($VenueRS);
  16. }
  17. ?>
  18. </select>
  19.  
Jun 27 '07 #1
5 1768
chaos
52
As i doing timetable system whereby ppl can book the venue and it will update the system



this code might help u all understand how i check the check button work
[PHP]<input type="button" name="Button" value="Check" onClick="checkfacility(change_timetable.p_time.val ue,change_timetable.p_day.value,change_timetable.p _venue.value,change_timetable.p_duration.value,'us er')">[/PHP]

This is checkfacility.php
Expand|Select|Wrap|Line Numbers
  1. <body>
  2. <?php $day= $_GET['day']; ?>
  3. <?php $duration= $_GET['duration']; ?>
  4. <?php $venue= $_GET['venue']; ?>
  5. <?php $time= $_GET['time']; ?>
  6. <?php $rights= $_GET['rights']; ?>
  7.  
  8. <?php     setcookie("Venue",$venue);
  9.     setcookie("Day",$day);
  10.     setcookie("Time",$time);
  11.     setcookie("Duration",$duration);
  12. ?>
  13.  
  14. <?php
  15.  
  16. switch($time)
  17. {
  18.     case '0800': $hourset = 0; break;
  19.     case '0900': $hourset = 1; break;
  20.     case '1010': $hourset = 2; break;
  21.     case '1110': $hourset = 3; break;
  22.     case '1205': $hourset = 4; break;
  23.     case '1300': $hourset = 5; break;
  24.     case '1400': $hourset = 6; break;
  25.     case '1510': $hourset = 7; break;
  26.     case '1610': $hourset = 8; break;
  27.     case '1710': $hourset = 9; break;
  28. }
  29.  
  30. switch($day)
  31. {
  32.     case 'Monday':        //timeslot is from 0 to 9
  33.                         switch($hourset)
  34.                         {
  35.                             case 0:    $slot=0; break;
  36.                             case 1: $slot=1; break;
  37.                             case 2: $slot=2; break;
  38.                             case 3: $slot=3; break;
  39.                             case 4: $slot=4; break;
  40.                             case 5: $slot=5; break;
  41.                             case 6: $slot=6; break;
  42.                             case 7: $slot=7; break;
  43.                             case 8: $slot=8; break;
  44.                             case 9: $slot=9; break;
  45.                         }
  46.                         break;
  47.  
  48.     case 'Tuesday':        //time slot is from 10-19
  49.                         switch($hourset)
  50.                         {
  51.                             case 0:    $slot=10; break;
  52.                             case 1: $slot=11; break;
  53.                             case 2: $slot=12; break;
  54.                             case 3: $slot=13; break;
  55.                             case 4: $slot=14; break;
  56.                             case 5: $slot=15; break;
  57.                             case 6: $slot=16; break;
  58.                             case 7: $slot=17; break;
  59.                             case 8: $slot=18; break;
  60.                             case 9: $slot=19; break;
  61.                         }
  62.                         break;
  63.  
  64.     case 'Wednesday':    //time slot is from 20-29
  65.                         switch($hourset)
  66.                         {
  67.                             case 0:    $slot=20; break;
  68.                             case 1: $slot=21; break;
  69.                             case 2: $slot=22; break;
  70.                             case 3: $slot=23; break;
  71.                             case 4: $slot=24; break;
  72.                             case 5: $slot=25; break;
  73.                             case 6: $slot=26; break;
  74.                             case 7: $slot=27; break;
  75.                             case 8: $slot=28; break;
  76.                             case 9: $slot=29; break;
  77.                         }
  78.                         break;    
  79.  
  80.     case 'Thursday':    // time slot is 30-39
  81.                         switch($hourset)
  82.                         {
  83.                             case 0:    $slot=30; break;
  84.                             case 1: $slot=31; break;
  85.                             case 2: $slot=32; break;
  86.                             case 3: $slot=33; break;
  87.                             case 4: $slot=34; break;
  88.                             case 5: $slot=35; break;
  89.                             case 6: $slot=36; break;
  90.                             case 7: $slot=37; break;
  91.                             case 8: $slot=38; break;
  92.                             case 9: $slot=39; break;
  93.                         }
  94.                         break;
  95.  
  96.     case 'Friday':        // time slot is 40-49
  97.                         switch($hourset)
  98.                         {
  99.                             case 0:    $slot=40; break;
  100.                             case 1: $slot=41; break;
  101.                             case 2: $slot=42; break;
  102.                             case 3: $slot=43; break;
  103.                             case 4: $slot=44; break;
  104.                             case 5: $slot=45; break;
  105.                             case 6: $slot=46; break;
  106.                             case 7: $slot=47; break;
  107.                             case 8: $slot=48; break;
  108.                             case 9: $slot=49; break;
  109.                         }
  110.                         break;
  111.  
  112.     case 'Saturday':    // time slot is 50-54
  113.                         switch($hourset)
  114.                         {
  115.                             case 0:    $slot=50; break;
  116.                             case 1: $slot=51; break;
  117.                             case 2: $slot=52; break;
  118.                             case 3: $slot=53; break;
  119.                             case 4: $slot=54; break;
  120.                             case 5: $slot=55; break;
  121.                             case 6: $slot=56; break;
  122.                             case 7: $slot=57; break;
  123.                             case 8: $slot=58; break;
  124.                             case 9: $slot=59; break;
  125.                         }
  126.                         break;
  127. }
  128. ?>
  129.  
  130. <?php
  131. echo $time;
  132. echo "<BR>Time slot is ".$slot."<BR>";
  133.  
  134. mysql_select_db($database_conn, $conn);
  135. $query_Recordset2 = "SELECT * FROM facilities WHERE venue='$venue'";
  136. $Recordset2 = mysql_query($query_Recordset2, $conn) or die(mysql_error());
  137. $row_Recordset2 = mysql_fetch_assoc($Recordset2);
  138. $totalRows_Recordset2 = mysql_num_rows($Recordset2);
  139.  
  140. $query_RS3 = "SELECT * FROM staff WHERE staff_1 ='".$_SESSION['MM_Username']."'";
  141. echo $query_RS3;
  142. $RS3 = mysql_query($query_RS3, $conn) or die(mysql_error());
  143. $row_RS3= mysql_fetch_assoc($RS3);
  144. $totalRows_RS3 = mysql_num_rows($RS3);
  145.  
  146.  
  147. $canBook=true;
  148.  
  149. for($i=0;$i<$duration;$i++)
  150. {
  151. $facilityAvailable =$row_Recordset2["_".($slot+$i)];
  152. echo "_".($slot+$i)."=".$facilityAvailable."<BR>";
  153.  
  154. if($facilityAvailable!=0)
  155.     $canBook=false;
  156.     for($i=0;$i<$duration;$i++)
  157.     {
  158.         $ModuleAtProposedSlot=$row_RS3["_".($slot+$i)];
  159.  
  160.         if($ModuleAtProposedSlot!=0)
  161.             $canBook=false;
  162.     }
  163. }
  164.  
  165.     if($canBook)
  166.     {
  167.         if ($rights =="admin")
  168.         {
  169.             echo "<script>alert('Change Request OK. Proceed to Approve')
  170.         window.opener.location=window.opener.location+'&&showSubmit=true'
  171.             </script>";
  172.         }
  173.         else
  174.         {
  175.             echo "<script>alert('Available for booking')
  176.         window.opener.location=window.opener.location+'&&showSubmit=true'
  177.             </script>";
  178.         }    
  179.     }
  180.     else
  181.     {    
  182.         if ($rights =="admin")
  183.         {    
  184.             echo "<script>alert('Facility not available!')
  185.                 window.opener.location=window.opener.location+'&&showSubmit=false'
  186.             </script>";
  187.         }
  188.  
  189.         else
  190.         {    
  191.             echo "<script>alert('This timeslot is not available!')
  192.                 window.opener.location=window.opener.location+'&&showSubmit=false'
  193.             </script>";
  194.         }
  195.  
  196.         unset($_COOKIE['Venue']);
  197.     }
  198.     echo "<script>window.close()</script>";
  199. ?>
[Please use CODE tags when posting source code. Thanks! --pbmods]
Jun 27 '07 #2
chaos
52
Someone Pls Help Me
THX
Jun 28 '07 #3
chaos
52
anyone know how to solve the problem
Jun 29 '07 #4
chaos
52
Help Help Help !!!
Anyone Pls Help Me!
Jul 1 '07 #5
kovik
1,044 Expert 1GB
No one will help you because:

1) You haven't asked much of a question other than "help me!"
2) You aren't even trying... I help those who help themselves.
3) You've posted too much code. No one wants to read it all, and most of it doesn't matter.
4) You're spamming the board with bumps.

Here's what you need to do:

1) Think logically about the problem.
2) Don't expect PHP to be magic.
3) Find out *exactly* where the problem is occurring
4) THEN ask questions.

Now, please stop spamming. I haven't read your code because it's obvious that you're hardly trying... Just looking for hand-outs.
Jul 1 '07 #6

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

Similar topics

5
by: Al Davis | last post by:
Note: I tried cross-posting this message to several newsgoups, including comp.lang.perl.misc, c.l.p.moderated, comp.infosystems.www.authoring.cgi, comp.lang.javascript and comp.lang.php. Nothing...
4
by: Jens Riedel | last post by:
Hi, I use a select box with a fix width (via stylesheet). So some of the entries are cut on the right side if they're too long. Is there a way to display them complete like a tool tip on a...
44
by: Mariusz Jedrzejewski | last post by:
Hi, I'll be very grateful if somebody can explain me why my Opera 7.23 (runing under linux) doesn't show me inner tables. Using below code I can see only "inner table 1". There is no problem with...
3
by: Bryan Harrington | last post by:
I have a list of requests that I'm displaying. The client wants to be able to display the details of the FIRST request as the page loads. Right now, as I loop through the recordset, I'm checking...
9
by: sergio | last post by:
Hi all, I have created the following script that will show/hide a menu based on checkboxes. It works fine in Opera but not on IE6! Does anybody knows a workaround this problem? Thanks for your...
20
by: WindAndWaves | last post by:
Hi Gurus I was wondering if you can send me in the right direction: I have a table with about 300 rows. I want to make all of them invisible and when a user enters a code in a form then make...
5
by: psvhans | last post by:
Hi I have 3 colums: 'Task' , 'Case ID' and ' Time' And i would like to have an overwiew of the last task (the taks with de latest time) of every Case ID. Example Task Case ID Time...
20
by: ed | last post by:
Hi I can't seem to make the Me.Show() work My code is dim dlgresult as dialogresul dlgresult=me.show( The message is : "expression does not produce a value
130
by: Daniel Manes | last post by:
I'm baffled. I have a column in a SQL Server Express database called "Longitude," which is a float. When I view the table in a DataGridView, some of the numbers, which only have two decimal places...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
3
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.