Jump to content

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


ltoto

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.
Link to comment
https://forums.phpfreaks.com/topic/20865-solved-2-ids-on-1-line-in-a-link/
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.
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]

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.