How to add multi items to shopping cart simutanously?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lucoin
    New Member
    • Sep 2007
    • 24

    How to add multi items to shopping cart simutanously?

    I am doing a tickets booking system, it requests in one page list all the tickets info includes from city, to city, price and followed a textbox to input the number of tickets want to book. and at the bottom of the page is a 'buy' button, when the customer click on the button, all the routes the customer choose will be added to the shopping cart simutanously.
    I can do if just add one item to the shopping cart, but have a problem about more than one item simutanously.
    Thank you for your help.
  • lucoin
    New Member
    • Sep 2007
    • 24

    #2
    the tickets list page likes following:
    From City | To City | Price | Qty |
    -- Sydney -- | London | 700 | [ 0 ] |
    -- Sydney -- | Paris -- | 690 | [ 0 ] |

    [Buy]

    Comment

    • kovik
      Recognized Expert Top Contributor
      • Jun 2007
      • 1044

      #3
      E-commerce isn't necessarily simple enough that you can give a brief explanation and a simple diagram, and then expect an answer. You'll need to share a bit more code and the classes you use to accomplish this. If you aren't using classes, this would be a good time to start.

      Comment

      • Weisbartb
        New Member
        • Aug 2007
        • 36

        #4
        Quick and simple answer is you need to use HTML 4.0 post arrays
        Code:
        <input type="text" name="payload[fieldname]">
        To access this after the form was submited
        [PHP]
        foreach($_POST['payload'] as $key => $value){
        //Do your thing here
        }
        [/php]

        As the above poster stated. E-commerce isn't something you just "wing".

        Comment

        • lucoin
          New Member
          • Sep 2007
          • 24

          #5
          Originally posted by Weisbartb
          Quick and simple answer is you need to use HTML 4.0 post arrays
          Code:
          <input type="text" name="payload[fieldname]">
          To access this after the form was submited
          [PHP]
          foreach($_POST['payload'] as $key => $value){
          //Do your thing here
          }
          [/php]

          As the above poster stated. E-commerce isn't something you just "wing".
          Thank you! I'll try this. what I have done before is to use a loop to get the variables. I list the textfields in order, and in the session when I want to check all the inputs, I just execute a loop.

          Comment

          Working...