Forum Moderators: coopster

Message Too Old, No Replies

How do I use form method $_GET with many action files?

HTML Forms with PHP/MySQL

         

M_K_Rao

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



There is a basic html form which has method get and action another file which contains several links.
Now what i require my program to do is take the 'form get variables' in these links to access the backend db for some information.

One of the links is #*$!.php which connects to the db and queries some info.
likewise for other links.
So basically I have a set of different select query statements which I would like to throw to the user as and when clicked upon that link.

And all the links must point to the same get variable from the form.

I have been trying all variations for 3 days now.

Help.

M_K_Rao

10:00 am on Apr 6, 2005 (gmt 0)



I am sure there is a small fix to it .
My code runs as :
<form method=get action =#*$!.php>

In xxx.php, the code besides selecting data from db also has a link to another .php file which selects a second set of data.

Can I use the following when defining a link?

<a href ="123.php?var=".$_GET['var']>Click here for more data from db</a>

The above does'nt work.
What is the correct way to do it?

IamStang

11:29 am on Apr 6, 2005 (gmt 0)

10+ Year Member



As far as what you can try for your link to work.

<a href ="123.php?var=".$_GET['var']>Click here for more data from db</a>

Doesnt work

This should:

$moreData = $_GET['var'];
?>
<a href ="123.php?var=<?=$moreData?>">Click here for more data from db</a>
<?

Or you could do it with print or echo

$moreData = $_GET['var'];
echo "<a href =\"123.php?var=".$moreData."\">Click here for more data from db</a>";

Hope it helps. If not, I tried.

M_K_Rao

11:56 am on Apr 6, 2005 (gmt 0)



It finally worked.

Svar=$_GET['var'];
print "<a href=123.php?var=$var>Click here</a>";

I remember trying this earlier but would'nt work then .

Now it is working fine.

Thanks very much.