Jump to content

Passing data with <a href....>


RobertSubnet

Recommended Posts

Greetings all.

 

I am using mysql_fetch_array() and a while loop to retrieve data from a MySQL database. The loop is also used to populate an associative array.

 

I would like to pass the retrieved data to another PHP script, preferably using an anchor tag with an href attribute. Is there a way to do this or am I stuck having to use a form/submit?

 

Thanks,

~Robert

Link to comment
https://forums.phpfreaks.com/topic/96717-passing-data-with/
Share on other sites

So lets say I have a URL:

 

\\mywebsite.com/firstpage.php

 

In the firstpage.php script, I have a variable, $variable = 10 and I want to pass the value (10) to another script, lets say secondpage.php. Would the link on firstpage.php look like this:

 

<a href = mywebsite.com/secondpage.php?variable = 10>Click Me</a>

 

Then to access the $variable value (10) on secondpage.php, I would code it as:

 

$variable_on_secondpage_php = $_GET['variable'];

 

Thanks again.

Link to comment
https://forums.phpfreaks.com/topic/96717-passing-data-with/#findComment-495128
Share on other sites

So lets say I have a URL:

 

\\mywebsite.com/firstpage.php

 

In the firstpage.php script, I have a variable, $variable = 10 and I want to pass the value (10) to another script, lets say secondpage.php. Would the link on firstpage.php look like this:

 

<a href = mywebsite.com/secondpage.php?variable = 10>Click Me</a>

 

Then to access the $variable value (10) on secondpage.php, I would code it as:

 

$variable_on_secondpage_php = $_GET['variable'];

 

Thanks again.

 

yup!

 

or to make sure the variable (whatever it is is passed),

 

<a href="mywebsite.com/secondpage.php?variable=<?php echo $variable; ?>">Click Me</a>

Link to comment
https://forums.phpfreaks.com/topic/96717-passing-data-with/#findComment-495136
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.