Scoot said it all !! .. Just one more little thing , .. When posting a
form using POST you do a response page lets say form.php, if you want to
reload the page the browser will ask you to send the data again so
form.php can handle the data again,  you dont have this problem with GET
because, as scott said, the parameters are part of the url. Still POST
is the best for forms and this problem is not that big.


Therein lies the difference.  With POST, you cannot see the variables
that are being passed, because they are passed as a header directly to
the server.  With GET, you see the variables, because they are part of
the URL that is passed to the Server.  

The other difference is in that URL's tend to have a limit on how long
they can be, a post does not.  So if you are planning on using a bunch
of Form Variables you need to use post.  ( OF Course I think the URL
limit is somewhere around 32000.  ;-)  )

I use POST if I don't want to worry about directly calling the page
through a link, or if I am passing sensitive information.  (It's not a
good idea to hide a password with * if you are going to just send the
form with a GET.)  If I would want to call the page differently via a
Link, I use GET.  

Say you want to call a page in multiple ways via an ActionID.  The
ActionID would be best used as a GET variable, because you could call it
from a FORM or a Direct Link very easily.  (EXAMPLE:
"form.php?ActionID=1")

-- 
Scott Carr
OpenOffice.org
Documentation Maintainer
http://documentation.openoffice.org/


Quoting Samura1 <[EMAIL PROTECTED]>:

> One more thing,
> I found that POST is better than GET as user won't see the variables 
> .... But there must be a disadvantage of POST, otherwise, no one use 
> GET... do you know what are the disadvantages of POST?
> 
> Thank you.
> 
> p.s and I'm looking for a very good website which talk about when you 
> should use this or when you shouldn't use this on PHP (including 
> reasons) ... if u know, pls let me know... as I'm a DIY learner, just 
> trying everything out but dunno it's a good way to do or not...
> 
> 
> "Samura1" <[EMAIL PROTECTED]> ¼¶¼g©ó¶l¥ó·s»D 
> :[EMAIL PROTECTED]
> > Hey man, your post is very helpful ...
> >
> > But actually, I just found out the solution on the web... You know 
> > what, most web sites are just telling you what does it do (submit to

> > the server, header...$#&Q*^$@#) , but doesn't give u an example...
> >
> > Until I just found an example on the web, make my mind much 
> > clearer...
> >
> > And your example is exactly what I need before...
> >
> > Thanks anyway..
> >
> >
> >
> > "B.A.T. Svensson" <[EMAIL PROTECTED]> 
> > ???????:000601c243a6$fb3b12e0$[EMAIL PROTECTED]
> > > Well lest go trough the basic steps then (but I still recomend you

> > > to
> > visist the www.w3.org
> > > and realy spend some time trying to understand the specifications 
> > > - it
> > will save you lots
> > > of headache in the future...):
> > >
> > > First you start with the FORM tag:
> > >
> > >   <form method=POST action=start.asp>
> > >
> > > Here we see two attributes METHOD and ACTION.
> > >
> > > METHOD should be POST in our case, and the ACTION is a pointer to 
> > > a page
> > that should
> > > be handling the FORM request. In this case that page is called
> START.ASP,
> > in your
> > > case it should probably be with the file extension .PHP.
> > >
> > >
> > > What we then need is some interactive input fields:
> > >
> > >           <select name=Tissue>
> > >             <option value=0>Unspecified</option>
> > >             <option value=1>Brain</option>
> > >             <option value=2>Eye</option>
> > >             <option value=3>Liver</option>
> > >             <option value=4>Heart</option>
> > >             <option value=5>Muscel</option>
> > >             <option value=5>Splein</option>
> > >           </select>
> > >
> > > We choice to display a drop down menu with some various items 
> > > found in the OPTION-tag. The SELECT as to be refereed with a NAME 
> > > so we can refer to it once the START.ASP page is loaded. The name 
> > > of the variable that START.ASP will be able to figure out which 
> > > option we select will hence be "Tissue".
> > >
> > > Finally we need a button to be able to submit the selected data:
> > >
> > >           <input type=submit value='Go now' name=Submit>
> > >
> > > And then we ends the form:
> > >
> > >   </FORM>
> > >
> > > Once we press the "Go Now" button, the form data will be posted to

> > > the webserver, but the handlig page (START.ASP) need a script to 
> > > extract the data. This is done like this is VBScript:
> > >
> > >    Tissue = Request.Form("Tissue")
> > >
> > >
> > > In PHP I think a reference to a posted variable is done something 
> > > like
> > this:
> > >
> > >        $HTTP_POST_VARS['Tissue'];
> > >
> > > Knowing this it should be a quite simple to continue with whatever

> > > you
> > need to do.
> > >
> > > Check this link for more details about POSTing:
> > >
> > >
> >
> http://www.php.net/manual/en/language.variables.external.php#language.
> variab
> > les.external.form
> > >
> > > If you want to uplaod a file instead, you might want to check this

> > > out:
> > >
> > > http://www.php.net/manual/en/features.file-upload.php
> > >
> > >
> > > Cheers,
> > > Anders
> > >
> > > > -----Original Message-----
> > > > From: Samura1 [mailto:[EMAIL PROTECTED]]
> > > > Sent: Wednesday, August 14, 2002 5:01 PM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: Re: [PHP-WIN] PHP & "POST"
> > > >
> > > >
> > > > First, I don't know how to use POST, is it just changing the 
> > > > value GET
> > in
> > > > the form to POST?
> > > > Secondly, because I don't know where does it send to, I don't 
> > > > know
> where
> > to
> > > > get it, and I don't know how to get it even I know... so....... 
> > > > Anyone can show me an example coding for POST and how to get the

> > > > data
> > from
> > > > POST pls....
> > > >
> > > > "B.A.T. Svensson" <[EMAIL PROTECTED]> 
> > > > ???????:000001c24381$9ebbb8a0$[EMAIL PROTECTED]
> > > > > Have you tried this URL yet:
> > > > http://www.w3.org/TR/html401/interact/forms.html#edef-FORM
> > > > > (www.w3.org might want to be your first choice when your are 
> > > > > looking
> > for
> > > > specifications
> > > > > details about HTML and HTTP transfers.)
> > > > >
> > > > > Also remember that GET is restricted to ASCII transfers, and 
> > > > > if you
> > > > happens
> > > > > to have binary data you should uses POST.
> > > > >
> > > > > But more precisly what are your problems:
> > > > >
> > > > > 1) can't post the data
> > > > > 2) can't get the values from posted data
> > > > > 3) something else
> > > > >
> > > > > ??
> > > > >
> > > > > Cheers,
> > > > > Anders
> > > > >
> > > > > > -----Original Message-----
> > > > > > From: Samura1 [mailto:[EMAIL PROTECTED]]
> > > > > > Sent: Wednesday, August 14, 2002 12:32 PM
> > > > > > To: [EMAIL PROTECTED]
> > > > > > Subject: [PHP-WIN] PHP & "POST"
> > > > > >
> > > > > >
> > > > > > Hey guys,
> > > > > > I want to know how to retrieve data from POST (form) ...
> > > > > >
> > > > > > What I want to do is...
> > > > > >
> > > > > > I've got a textarea for ppl to enter large amount of text 
> > > > > > (essay),
> > and I
> > > > let
> > > > > > ppl submit it (using POST), then insert these data into 
> > > > > > mySQL.
> > > > > >
> > > > > > I get it working if I use GET (I only know how to use GET, 
> > > > > > dunno
> > about
> > > > POST)
> > > > > > with small amount of words (say 1600 characters), but when 
> > > > > > there
> are
> > > > more
> > > > > > than 2000 characters, the submit button doesn't work. And I 
> > > > > > found
> > that
> > > > it is
> > > > > > becoz GET does not allow too large amount of text appear in 
> > > > > > the
> > URL...
> > > > > >
> > > > > > So anyone can teach me how to get data from POST? I read 
> > > > > > some web
> > sites
> > > > but
> > > > > > still have no idea how to do it ... I think I need an 
> > > > > > example...
> > > > > >
> > > > > > Please help
> > > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > PHP Windows Mailing List (http://www.php.net/)
> > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > >
> >
> >
> 
> 
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to