Results 1 to 7 of 7

Thread: POST and redirects

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default POST and redirects

    I have a form where I send info from a login page to a validation page using POST. If the values on page 2 do not validate there is a javascript snippet to redirect to page 1. If the values do validate then the user is redirected via javascript to the user control panel. The user never really sees the login validation page. How do I send the failed values back to page 1 using POST? I can use GET, but I am trying to figure out what I am doing wrong with POST.

    If you need more, let me know.
    To choose the lesser of two evils is still to choose evil. My personal site

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Why not validate on the same page or via ajax?
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    not really familiar with ajax. The values are stored in a database.
    To choose the lesser of two evils is still to choose evil. My personal site

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Okay, I'd validate on the same page than, you should still be able to get the values from the DB when the page is reprocessed with the POST data.

    I'm not familiar with this but it sounds like it could work as well http://pear.php.net/manual/en/packag...lient.post.php
    Last edited by bluewalrus; 11-10-2010 at 09:01 PM.
    Corrections to my coding/thoughts welcome.

  5. #5
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    I think that the best way to do this would be to use cookies or, better yet, sessions. Getting addons for php seems a bit much work for this project. I'm just trying to see if I am missing something simple about POST. POST is used to send info from one page to another, but why not from the first to the second to the third? I figure there should be a way to propagate the POST via a command line in page 2.
    To choose the lesser of two evils is still to choose evil. My personal site

  6. #6
    Join Date
    Sep 2008
    Location
    Bristol - UK
    Posts
    842
    Thanks
    32
    Thanked 132 Times in 131 Posts

    Default

    The POST array is created by a form submission, that's why you can't use really use it for the second page. If you don't want to use cookies or sessions, maybe something like this:

    Loop through the $_POST array, figure out whether it's valid or not, then submit a dynamically generated form via javascript when you're done.

    The above is a very long winded way of doing it.

    Validating the form on the same page is a much easier way of doing this, what is the need in the script going to a second page?

  7. #7
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    Check out cURL and then check out a nice cURL tutorial.
    Jeremy | jfein.net

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
  •