Jump to content

Passing variables through URL


swampone

Recommended Posts

Im trying to pass multiple variables to a URL. I am able to get the first URL through, but not any others.

 

$link_b = ("<a href=\"view.php?vkey=".$vkey."&title=".$meta."\">".$meta."</a>");

 

The value of vkey is seen in the url, but the value of title is not. The URL i get looks like the following:

 

http://localhost/view.php?vkey=765297369

 

I need it to look like the following, so i can have access to variables on the new page:

 

http://localhost/view.php?vkey=765297369&title=$meta

 

Link to comment
https://forums.phpfreaks.com/topic/199017-passing-variables-through-url/
Share on other sites

Not sure why, but when I swapped the two variables around, it works just how I want it to.

<?php
//shows both the values of title and vkey
$link_b = "<a href=\"view.php?title={$meta}&vkey={$vkey}\">{$meta}</a>";

//Only give me the value of vkey
$link_b = "<a href=\"view.php?vkey={$vkey}&title={$meta}\">{$meta}</a>";

?>

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.