Help! - posting multiple variables in a hyperlink

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mhouldridge
Forum Contributor
Posts: 267
Joined: Wed Jan 26, 2005 5:13 am

Help! - posting multiple variables in a hyperlink

Post by mhouldridge »

Hi,

I would like to post to another page multiple variables within a hyperlink. Here is the code that I have;

Code: Select all

<? 
$remove = "remove";
echo "<a href='removeandstore.php?varl=".$formVars['asset']."&var2=".$formVars['software']."&var3=".$formVars['license']."'>".$remove."</a> \n"
?>
The

Code: Select all

varl=".$formVars['asset']."
one works a treat, however the following two variables do not post, or show within the address bar. I have defined everything fine, just the data isnt captured.

Please help.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

The variables are in a URL -> They are available through $_GET instead of $_POST
User avatar
harrisonad
Forum Contributor
Posts: 288
Joined: Fri Oct 15, 2004 4:58 am
Location: Philippines
Contact:

Post by harrisonad »

yeah, tim's right. and how do you retrieve it's value, anyway? are you sure they are not 'posted' (ei. saved to $_GET)?
try...

Code: Select all

print_r($_GET);
User avatar
mhouldridge
Forum Contributor
Posts: 267
Joined: Wed Jan 26, 2005 5:13 am

Post by mhouldridge »

Hi,

Sorry, this is one that I have come back to. I have a page which displays the asset number, software and license in text fields. There is a remove link which when clicked posts to another page which displays this information and then prompts the user to confirm and delete the information.

This is kinda working. My address field shows for one of them the following;

http://localhost/removeandstore.php?varl=[b]000091[/b]&var2=aasdfasd&var3=fasdfasdf

As you can see this is posting correctly, however my echo commands only show the first character for the second two, ie. var2 only shows letter "a" and var3 only shows letter "f"

Any thoughts?
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

mhouldridge wrote:As you can see this is posting correctly, however my echo commands only show the first character for the second two, ie. var2 only shows letter "a" and var3 only shows letter "f"

Any thoughts?
I think you're echo'ing a string as if it's an array.
Post Reply