Forums

PHP

This topic is locked

Havid trouble with Forms Post or Get

Posted 03 Dec 2002 00:48:28
1
has voted
03 Dec 2002 00:48:28 David Val posted:
Hello all,

I am having a little trouble with POST and GET in my form page. I understand
the two when I read out of text books but I only can get the GET method to
work but not the POST method.

I have a product list page using several drop-down menus with a go button in
each one, each one has its own form tag. At first I could not get the POST
to work and someone suggested to use the GET method. So I changed my method
to GET and my Run-time Value to $HTTP_GET_VARS['PageNumber'] on my recordset
page. And it works!! <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> But get this, when I created a Search engine I had
to use the POST method. The GET method did not work. So in doing this I had
to create a new page to pull information that was requested from the search.
But prefer to get everything go to one result page.

But also when ever I use my search engine and pull up information I tried to
use the back button or refresh in the browser (IE 6.0.x) I get these
following errors:

Refresh Button results:

The page cannot be refreshed without resending the information. Click Retry
to send the information again, or click Cancel to return to the page that
you were trying to view.

Back Buttons Results:

Warning: Page has Expired
The page you requested was created using information you submitted in a
form. This page is no longer available. As a security precaution, Internet
Explorer does not automatically resubmit your information for you.

To resubmit your information and view this Web page, click the Refresh
button.

So now I am confused. I perfer to use the POST method on all my pages. And I
don't know why I can use one and not the other. Do I need to change anything
in my PHP4 setting to excepted POST method a little bit better and to stop
the pages to expire?

I developing on a:
Windows 2000XP Pro
Apache\1.3.23(Win32)
PHP4 ver. 4.2.3

After I finish testing everything I send it to the main web server which is
a Unix server that uses the same PHP4 ver. I use.

I hope someone could help me

ThX

David


Replies

Replied 09 Dec 2002 23:47:07
09 Dec 2002 23:47:07 Carl Heaton replied:
The problem with the EXPIRED and REFRESH thing is that data has been posted to the page that your are doing a history(-1) to ( IE and most other browsers dont like this )...
Make your back button as form post back buttons, posting the passed variables to the back page should remove this issue.
also
i preffer to use $_GET['varname'] and $_POST['varmame'] ( it may be PHP4 only not 100% sure ).

If you want to know what is being passed as POST || GET use

<pre id=code><font face=courier size=2 id=code>&lt;?PHP
echo "&lt;PRE&gt; GET :";
print_r($_GET);
echo "POST :";
print_r($_POST);
echo "&lt;/PRE&gt;";
?&gt;</font id=code></pre id=code>

#########
www.pipeten.com/windows_hosting.html
Windows Hosting with MSSQL and ASP<br>
www.pipeten.com/linux_hosting.html
PHP Hosting with MySQL, Postgres and PHP

Edited by - g_a_t_e on 10 Dec 2002 00:09:53

Reply to this topic