Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 10 of 10
  1. #1
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    139 times
    Just want to make sure I've got this right:

    $_GET[] should be used in a form when you don't mind the variables to be seen in the URL. $_POST[] should be used when you do mind, or when it's a hidden variable.

    Comments?
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  2.  

  3. #2
    Member drews's Avatar
    Join Date
    Nov 2002
    Location
    St. Petersburg, Florida
    Posts
    63
    Member #
    341
    Right. Also if you have sensitive data (passwords, credit card numers, etc), it's better to send by POST.
    -drews
    -White Fiber Hosting - Coming Soon!

  4. #3
    Senior Member ajaspers's Avatar
    Join Date
    Apr 2003
    Posts
    149
    Member #
    1150
    Credit card numbers should be sent over SSL.

  5. #4
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    $_POST is generally used when:

    1. There is a lot of information
    2. The information is likely to change or be generated directly as a result of the data
    3. You don't want it in the URL (very annoying at times, though, such as with UPS's tracking site where you can't bookmark the exact page)

    Usually you use POST when submitting a form, GET for URLs.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  6. #5
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,657
    Member #
    1234
    Liked
    139 times
    But can't you pass the results of a form to a URL? I'm working on a huge DB site, and pretty much all of the results of a form will result in various UIDs from the DB.
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  7. #6
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Yes you can.

    I like to think of it this way: if the URL generated by a GET is longer than the address box, then use POST instead. Nobody likes URLs that are a page long.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  8. #7
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    <form action="get"> sends the parameters in querystring
    <form action="post"> sends the parameters in http header

    An important thing to remember when using GET is that you may have problems with escape characters in text values and you have a limited length in parameters (256 characters or so?). A post can pass significantly longer values (something like 65k characters), which makes it ideal for textarea inputs corresponding to text fields in your database.

    Personally, I only use GETs when I'm sending parameters via an anchor element, since it doesn't support POSTs.

  9. #8
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    POST can actually send a ridiculous amount of data for just a header...upwards of several hundred KB. Think about sites like this were attachments and such are posted by the browser (kind of overloading the simple intentions of HTTP, but whatever).
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  10. #9
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Originally posted by filburt1
    POST can actually send a ridiculous amount of data for just a header...upwards of several hundred KB. Think about sites like this were attachments and such are posted by the browser (kind of overloading the simple intentions of HTTP, but whatever).
    Doesn't this site se multipart-mime content for uploading image content? That would allow MB of data to be uploaded.

  11. #10
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Yes:
    <form enctype="multipart/form-data" action="newreply.php" name="vbform" method="post" onSubmit="return validate(this)">
    I still say HTTP wasn't designed for this just as HTML is not designed to do what it used for today, but each to his own.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:22 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com