Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    New Coder
    Join Date
    Apr 2011
    Posts
    47
    Thanks
    7
    Thanked 0 Times in 0 Posts
    double post

  2. #17
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,537
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Well, the obvious thing is... don't store into the session is your POST has no values, just like you wouldn't try to send an email from a form if the form had no data submitted. If you want your session variable not to contain something blank, if $_POST isn't set, don't store new values.

    The sessions are working fine, but you're not working with them properly.

  3. #18
    New Coder
    Join Date
    Apr 2011
    Posts
    47
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Should I just do what you are saying, and check if the $_POST field is empty and then set the values into an array. That way I could avoid SESSIONS entirely?

  4. #19
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,537
    Thanks
    45
    Thanked 259 Times in 256 Posts
    Well, if you just store them into an array, and not a session, you won't be able to move them between pages...

    I'm not really sure what you're trying to do anymore.

  5. #20
    New Coder
    Join Date
    Apr 2011
    Posts
    47
    Thanks
    7
    Thanked 0 Times in 0 Posts
    There are two pages (let's say page1 and page2).

    The first page contains numerous photos. Each photo contains a checkbox. If that checkbox is checked, a div opens revealing multiple select menus for choosing a number of photo prints at each size. It would looks something like this when the div opened:

    4"x6" [select a quanitity]
    5"x7" [select a quanitity]
    8"x10" [select a quanitity]
    ....

    So the user checks of all the photos that they want, and then select a quantity of each size for those specific photos. The user then presses a submit button, which leads us to page2.

    Page2 is used to process this info. All of the info from the photo form is then echoed for the user to review. So it might look something like this:

    Review your order:
    Photo 1 - (2) - 4"x6" prints, (4) - 5"x7" prints
    Photo 2 - (3) - 4"x6" prints, (1) - 8"x10" print
    ........

    All of that works fine. The photo selections are echoed perfectly.

    Page2 also contains a simple form to take in name, email, etc. The form also contains a hidden input field to pass along the order. At this point, if the page is refreshed, or if the user attempts to send the form, but gets errors in form validation, all of the values disappear. That is because the variables were being set based on the POST values from the previous page. So, of course, if the page is refreshed for any reason, the POST values no longer exist. So I started using SESSIONS to set all of the values so that they would still show up, even on refresh. Everything is working fine now, although you told me I was using SESSIONS improperly. I'm not quite sure how I'm using them improperly, though.


 
Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

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