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
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.
Link to comment
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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.