Forum Moderators: coopster

Message Too Old, No Replies

PHP Forms

How to reuse the user posted variables in the from

         

M_K_Rao

10:30 am on Apr 4, 2005 (gmt 0)



I am developing a PHP/MySQL web application. A plain HTML form takes information from the users to query from a backend MySQL database. I wish to throw only part-info through a php script and the rest of the db info as links in the php script. For the links HOW CAN I REUSE THE USER POSTED VARIABLES?

.$_GET['xx'] works in the main PHP script but not in the links.
Example :
abc.html uses a form of method get and action xyz.php.
In xyz.php some info is displayed by using .$_GET['']
But links in xyz.php are not able to use the same and hence unable to get db info.

M_K_Rao

11:42 am on Apr 4, 2005 (gmt 0)



Can I have multiple actions for a form?

tomda

11:55 am on Apr 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$_GET['xx'] works in the main PHP script but not in the links.

GET should work in the links.

Make sure that you GET the variable at the beginning of your code ($var=$_GET['var'];) and check in the url that variable name are correct

M_K_Rao

8:40 am on Apr 5, 2005 (gmt 0)



Nah! $_GET still does'nt work in the links.
In fact when i declare $var = $_GET['var'];
in the main action script, it does'nt work.
I am using the query statement with .$_GET['var']

The dot before the $_GET is doing the trick.

But it works fine for the action file but not for links.

Any help reg. $_GET usage would be appreciated.

M_K_Rao

6:12 am on Apr 6, 2005 (gmt 0)



Tried all variations. $_GET still poses a problem in links.

I have a form abc.html which has method get.
Now action needs to be several files as and when clicked on the links.

What is the syntax for that?

coopster

11:16 am on Apr 7, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld, M_K_Rao.


Any help reg. $_GET usage would be appreciated.

The manual pages regarding Predefined Variables [php.net] is a good start. You may also want to keep the print_r() funtion in mind. I use it quite often to dump the values of the superglobals variables to troubleshoot. Put something like this at the top of your action page:

print '<pre>'; 
print_r($_GET);
print '</pre>';