+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11

Thread: Group Bookings?

  1. #1
    Contracted Slave Centurion is on a distinguished road Centurion's Avatar
    Join Date
    Dec 2008
    Posts
    533
    Rep Power
    4

    Group Bookings?

    Hi,

    I have a form that creates a serious of click-able query-strings, when i click on one it populates a form then the user clicks submit and a booking is made.

    However, how would i create a multiple booking process so that they can click on many?

    or would i just have a different form, which consists of a drop down, asking for the number of bookings needed and then check if they are available.. then insert the records in the DB?

    suggestions please?

    Thanks

  2. #2
    Contracted Slave Centurion is on a distinguished road Centurion's Avatar
    Join Date
    Dec 2008
    Posts
    533
    Rep Power
    4

    I thought about have check boxes which correspond to the seats. So if 5 are checked then insert 5 records in the DB. No sure what the best option is?

  3. #3
    Barn Frequenter BLaaaaaaaaaarche will become famous soon enough BLaaaaaaaaaarche will become famous soon enough BLaaaaaaaaaarche's Avatar
    Join Date
    Mar 2008
    Posts
    188
    Rep Power
    5

    Quote Originally Posted by Centurion View Post
    I thought about have check boxes which correspond to the seats. So if 5 are checked then insert 5 records in the DB. No sure what the best option is?
    Yes, you can then loop through your checkboxes and insert whatever information it is that needs to be inserted. For instance:

    Code:
    <input type="checkbox" name="seat_1">
    <input type="checkbox" name="seat_2">
    <input type="checkbox" name="seat_3">
    <input type="checkbox" name="seat_4">
    <input type="checkbox" name="seat_5">
    
    
    For Each Item In Request.Form
    	If Left(Item, 4) = "seat" Then
    		intSeat = Split(Item, "_")(1)
    		strSQL = "INSERT INTO MyTable (seat) VALUES (" & intSeat & ")"
    		siteConn.Execute(strSQL)
    	End If
    Next
    
    "You'll never be as perfect as BLaaaaaaaaarche."

  4. #4
    Contracted Slave Centurion is on a distinguished road Centurion's Avatar
    Join Date
    Dec 2008
    Posts
    533
    Rep Power
    4

    Quote Originally Posted by BLaaaaaaaaaarche View Post
    Yes, you can then loop through your checkboxes and insert whatever information it is that needs to be inserted. For instance:

    Code:
    <input type="checkbox" name="seat_1">
    <input type="checkbox" name="seat_2">
    <input type="checkbox" name="seat_3">
    <input type="checkbox" name="seat_4">
    <input type="checkbox" name="seat_5">
    
    
    For Each Item In Request.Form
    	If Left(Item, 4) = "seat" Then
    		intSeat = Split(Item, "_")(1)
    		strSQL = "INSERT INTO MyTable (seat) VALUES (" & intSeat & ")"
    		siteConn.Execute(strSQL)
    	End If
    Next
    
    Thank you for your advice.. Sorry i didnt reply back sooner!

    I understand that based on the checkbox (checked) the code will insert. But how do i assign the show information to the check boxes? As currently i am querying the database for what is available and then displaying clickable hyperlinks where the user can click to make a booking for that seat.

    The code below displays the recordset values horizontally but im a bit puzzled to how i would assign the values to the check box?

    Code:
    'displays the records horizontally in a clickable hyperlink querystring
    DIM recCount2
    IF Not RS.EOF THEN
    Response.Write "<table width='4%'>"
    
    recCount2 = 0
    DO UNTIL RS.EOF 
    	
    	IF recCount2 Mod 5 = 0 THEN
    	Response.Write "<tr>"
    	END IF
    	
    'Response.Write "<td>"&"["&"<a target=""_self"" href=""book_show.asp?performanceID=" & rs("performanceID") & "&showName=" & Request.QueryString("showName") &"&performance_time=" & rs("performance_time") &"&price=" & rs("price") & """>" & ("x") & "</a>"&"]"&"</td>"
    
    Response.Write "<td>"&"["&"<input name="" type=""checkbox"" value="" />"&"]"&"</td>"
    
    
    recCount2 = recCount2 + 1
    
    	IF recCount2 Mod 5 = 0 THEN
    	Response.Write "</tr>"
    	END IF
    	
    RS.MoveNext
    LOOP
    
    IF recCount2 Mod 5 <0 THEN
    	Response.Write"</tr>"
    END IF
    	Response.Write"</table>"
    ELSE
    	Response.Write "Sorry, this show is fully booked!"
    END IF
    

  5. #5
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    Put the necessary show information into the value attribute on the checkbox input. Probably just use the PerformanceID in this case. The necessary text to be presented to the user would be between the <input> and </input> tags.

    For example
    Code:
    <input name="checkbox1" value="123" type="checkbox">Show123, Thursday 23 March 2010 20:00</input>
    
    f
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

  6. #6
    Contracted Slave Centurion is on a distinguished road Centurion's Avatar
    Join Date
    Dec 2008
    Posts
    533
    Rep Power
    4

    Quote Originally Posted by Wolffy View Post
    Put the necessary show information into the value attribute on the checkbox input. Probably just use the PerformanceID in this case. The necessary text to be presented to the user would be between the <input> and </input> tags.

    For example
    Code:
    <input name="checkbox1" value="123" type="checkbox">Show123, Thursday 23 March 2010 20:00</input>
    
    f
    the code should create the checkboxes based on how many seats are left. Each checkbox is equal to a seat.

    I have assigned the show information like you said and now my code seems to build the 'seats/checkboxes' and holds the query string value.

    Just need to build the insert page where it will check for the value from all the checked boxes.

    Call me crazy? but if i check 5 boxes, i will send this data over x 5 (obviously different values for different seats):

    Code:
    performanceID=184&showName=Tom&performance_time=02:00:00&price=5
    
    So how would i use the pseudo code BLaaaaaaaaaarche provided?
    Wouldn't i need to name each check-box with a number? and then have 30 insert statements to read each check-box value?????

  7. #7
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    Yes, name each checkbox with a number -- makes them easier to find that way.

    Rather than do 30 (or whatever) insert statements, you can build a query string using a SELECT ...UNION statement and do it as 1 statement:
    Code:
    Insert Into myTable
      (field1, field2, field3)
    Select 'ValueA1', 123, 'ValueA2'
    Union
    Select 'ValueB1', 456, 'ValueB2'
    Union
    Select 'ValueC1, 789, 'Value C2'
    --etc.
    
    Or a stored procedure would help, if the DBMS supports it.

    [edit]
    And I can't see a good reason to include anything but the PerformanceID in the value tag -- all the other information should be contained in the database already, so no need to send it again.[/edit]
    Last edited by Wolffy; February 2nd, 2010 at 11:19 AM.
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

  8. #8
    Contracted Slave Centurion is on a distinguished road Centurion's Avatar
    Join Date
    Dec 2008
    Posts
    533
    Rep Power
    4

    Quote Originally Posted by Wolffy View Post
    Yes, name each checkbox with a number -- makes them easier to find that way.

    Rather than do 30 (or whatever) insert statements, you can build a query string using a SELECT ...UNION statement and do it as 1 statement:
    Code:
    Insert Into myTable
      (field1, field2, field3)
    Select 'ValueA1', 123, 'ValueA2'
    Union
    Select 'ValueB1', 456, 'ValueB2'
    Union
    Select 'ValueC1, 789, 'Value C2'
    --etc.
    
    Or a stored procedure would help, if the DBMS supports it.

    [edit]
    And I can't see a good reason to include anything but the PerformanceID in the value tag -- all the other information should be contained in the database already, so no need to send it again.[/edit]
    Do you think what i am doing is a bit long winded? Should i not just have a simple drop down asking how many tickets the user wants and then just query the database to check if the amount is available and then insert the co-responding number of records?

  9. #9
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    Or create the dropdown with the lesser of (a) the number of seats available or (b) the maximum number of seat sa user can buy at once. It would be necessary to then check again that the number of seats requested are still available when the user submits the request in case those available seats went to another user. You would probably do this anyway when you accept payment from the user (assuming the application does this).

    Then there is the Ticketmaster model, which actually reserves the seats for a period of time (like 3 minutes) until payment is confirmed -- otherwise, the seats are returned to the pool. However, this is more complicated application.
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

  10. #10
    Contracted Slave Centurion is on a distinguished road Centurion's Avatar
    Join Date
    Dec 2008
    Posts
    533
    Rep Power
    4

    Quote Originally Posted by Wolffy View Post
    Or create the dropdown with the lesser of (a) the number of seats available or (b) the maximum number of seat sa user can buy at once. It would be necessary to then check again that the number of seats requested are still available when the user submits the request in case those available seats went to another user. You would probably do this anyway when you accept payment from the user (assuming the application does this).

    Then there is the Ticketmaster model, which actually reserves the seats for a period of time (like 3 minutes) until payment is confirmed -- otherwise, the seats are returned to the pool. However, this is more complicated application.
    hmmmmm the first suggestion sounds good to me.

    I have 3 price ranges so im guessing i would need the user to select if they want to sit, (front, middle or back row) then select how many tickets they want.

    I asume i would validate what is "available" with a price range the user selected. If all is ok, then insert the records?

+ Reply to Thread
Page 1 of 2 1 2 LastLast

Similar Threads

  1. Help retrieving # of records per group
    By Rebelle in forum ASP Development
    Replies: 18
    Last Post: April 15th, 2009, 04:31 PM
  2. Group by Problem
    By todd2006 in forum ASP Development
    Replies: 1
    Last Post: March 11th, 2009, 10:41 PM
  3. order by group by problem
    By todd2006 in forum SQL Development
    Replies: 9
    Last Post: March 9th, 2009, 03:16 PM
  4. Sql group by
    By BLaaaaaaaaaarche in forum SQL Development
    Replies: 4
    Last Post: February 12th, 2009, 12:27 PM
  5. Summing for each group only
    By Rebelle in forum ASP Development
    Replies: 13
    Last Post: June 5th, 2008, 02:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO