473,587 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

52 New Member
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 1794
chaos
52 New Member
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="checkf acility(change_ timetable.p_tim e.value,change_ timetable.p_day .value,change_t imetable.p_venu e.value,change_ timetable.p_dur ation.value,'us er')">[/PHP]

This is checkfacility.p hp
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 New Member
Someone Pls Help Me
THX
Jun 28 '07 #3
chaos
52 New Member
anyone know how to solve the problem
Jun 29 '07 #4
chaos
52 New Member
Help Help Help !!!
Anyone Pls Help Me!
Jul 1 '07 #5
kovik
1,044 Recognized Expert Top Contributor
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
3463
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 appeared on my news server, so I'm trying again - this time posting a separate copy of the message to each group. I'm thinking this should be...
4
9213
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 mouseover? Thanks, Jens
44
3855
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 other browsers (I checked it under Konqueror). Thank you in advance for your help. Regards. /Mariusz <HTML>
3
1453
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 the querystring for "rid", and if rid = "" then I do a response.redirect to the page adding the rid value to the querystring from the recordset. ...
9
2749
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 response. Sergio ------------------------------------------------ <script language="JavaScript" type="text/javascript">
20
2562
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 selected ones visible. At the moment, I am doing it as follows: www.corstorphinehouse.com/d/avail.html
5
1443
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 A 1 12:00
20
2427
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
6490
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 in the database show up with *15* decimal places and are ever so slightly off (in the example in the subject line, by about 2E-15). I'm not doing...
0
7915
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8339
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7967
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8220
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6619
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3840
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3872
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2347
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1185
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.