SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Jul 2009
    Posts
    220
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sending POST from a script to another?

    I think this is quite a common question?

    How do I send POST data from one script to another?

    I'm doing this login page which POST with form to a processing script. And if the authentication fails at the processing script, it should POST back an error message to the login page.

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,496
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by resting View Post
    I think this is quite a common question?
    yes
    How do I send POST data from one script to another?
    You don't. Form data can be sent as POST data. If you want to send data from one script to another, there are other ways to do so:
    - in the query string (GET, visible to all)
    - in a session
    - in a cookie
    - in the database

    Choose the one most suitable for your situation.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,813
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The usual way to do it if you have lots of data is to store the data in a database where the data is identified by a session. The session usually gets passed between pages using a cookie but when cookies are disabled it can get passed in the querystring instead.

    The querystring and cookies are the only way of passing info between pages except when data is POSTed.

    While it is possible to post data without having a form to start with iit means you have to manually generate ALL the headers for the following page manually so as to iincorporate the post fields.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


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
  •