faqts : Computers : Programming : Languages : PHP : Common Problems : Forms and User Input : URLs and Post or Get Methods

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

104 of 292 people (36%) answered Yes
Recently 1 of 10 people (10%) answered Yes

Entry

The post-variables don't come through
Post Variables don't come through. When I use GET in my forms my CGI work but when I change to use
Post Variables don't come through. When I use GET in my forms my CGI work but when I change to use
Post Variables don't come through. When I use GET in my forms it works fine
My Apache only processes 3/4 of my CGI output and stops mid sentence in the output HTML hence now an
I am trying to POST to a .php document with the <FORM action="validate.php" method="post">. But whe

Dec 29th, 2001 01:23
Cale Gibbard, Chris Hester, carola isiway, Ben Udall, Karl Uscroft, Michael Cole, http://www.weberdev.com/articles/PHP2HTML.html


I think this is what you are asking about...
Your HTML form should look like this:
<form enctype="multipart/form-data" method="post" action="results.php">
Search: <input type="text" name="q" size="23" 
maxlength="30" /> 
<input type="submit" value="Search" /> <input type="reset" value=" 
Clear " />
<br />Input the name you want to search for.</form>
Then when the Search button is pressed, the file "results.php" is 
loaded, and the query is in the string "q" (given by the "name" bit 
above.) In PHP, this needs to be used like any other string, by adding 
a dollar sign. So on your results page, you might have:
<?php echo "You searched for $q"; ?>
Hope this helps.
---
If POST is failing to give you any data...
You may also want to check to see if file_uploads is On in php.ini. If 
it's Off, POST doesn't seem to work.