Forum Moderators: coopster

Message Too Old, No Replies

How to use href to pass data to other webpage

         

alex298

8:25 am on Jun 13, 2005 (gmt 0)

10+ Year Member



Hello,

This may be simple to all of you but not for me.

I need to use PHP href to:
1. go to a webpage (webpage.php)
2. parse some variables (variable1 and variable2) with that link.

Is the following use correctly?
<a href='webpage.php?variable1=value1;variable2=value2'>Link To</a>

Can the variables (variable1 and variable2) pass to webpage.php by the above link?

Best regards

Alex

Romeo

8:52 am on Jun 13, 2005 (gmt 0)

10+ Year Member



Hi Alex,

and welcome to Webmasterworld.

Yes, the HTTP GET method may be used to pass data to a page.
<a href="webpage.php?variable1=value1&variable2=value2">Link To</a>
Note the '&' as separator between the variables.

The remote target server will get the data and you can use them like this:
<?php
$data1 = $_GET['variable1'];
$data2 = $_GET['variable2'];
?>

Regards,
R.