Jump to content

Archived

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

ltoto

*solved* 2 Ids on 1 line in a link?

Recommended Posts

[code]"{$_SERVER['PHP_SELF']}?Id=16?id={$row['Id']}">{$row['regionName']}[/code]

so as you can see i have 2 ids on one line,because i want it to first go to index.php?Id=16, because this is what page i want it to appear on, and then on that page i want id={$row['Id']}">{$row['regionName'] this bit to show up.

Share this post


Link to post
Share on other sites
You can pass as many variables as you want in a link but if you pass the same named variable twice how would the following script know what was going on.  If you want to pass the value of Id twice then give it a different name in the link and in the following script abstract that second value and do whatever you want with it ...

[code] href='...?Id=16&fake_Id=whatever&another_Id=something .... [/code]

Note that the ampersand is used to pass parameters after the first.

Share this post


Link to post
Share on other sites
im a little bit confused by what you mean by that, or maybe im missing somethign when i am reading it

Share this post


Link to post
Share on other sites
Simplifying ...

When you want to pass more than one variable in a link, use the ampersand as the separator for all links after the first:

[code] ....filename.php?x=1&y=2&z=3&myname=wombat[/code]

You can't pass two [i]different[/i] values for the [i]same[/i] variable.  The code below is nonsense:

[code] ....filename.php?x=1&x=2&x=3&x=wombat[/code]

Share this post


Link to post
Share on other sites
ahhh i think i understnad now, i think the only bit that confuses me is what i put before the 2nd id

Share this post


Link to post
Share on other sites
?Id=16[b]&[/b]id={$row['Id'] ... I'd be very careful with id and Id to make sure you don't confuse yourself and/or confuse the script that's trying to process the data

Share this post


Link to post
Share on other sites
ahh yes, i accidently missed the first Id out which was confusing me, but it is working fine now, thanks a lot man

Share this post


Link to post
Share on other sites

×

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.