Jump to content

Passing variables into URL


adrian_

Recommended Posts

Hi,

I'm trying to pass a variable into a URL and apparently I'm doing it wrong

 

this code is OK

$id = $3;
echo '<a href="newPage.php?id=3"></a>

If I use

$id = $_GET['id'];
echo $id;

on the newPage.php, I echo 3

whereas, if I do

$id = $3;
echo '<a href="newPage.php?id="'.$id.'"></a>

when echo out on the newPage.php it prints out nothing

also, in current url look like this:

www.site.com/newPage.php?id=

 

What am I doing wrong?  :shrug:

 

Many thanks

Link to comment
https://forums.phpfreaks.com/topic/248069-passing-variables-into-url/
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.