Jump to content


Photo

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


  • Please log in to reply
6 replies to this topic

#1 ltoto

ltoto
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts

Posted 15 September 2006 - 02:19 PM

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

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.

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 15 September 2006 - 02:28 PM

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

href='...?Id=16&fake_Id=whatever&another_Id=something ....

Note that the ampersand is used to pass parameters after the first.
Legend has it that reading the manual never killed anyone.
My site

#3 ltoto

ltoto
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts

Posted 15 September 2006 - 02:33 PM

im a little bit confused by what you mean by that, or maybe im missing somethign when i am reading it

#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 15 September 2006 - 02:36 PM

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:

....filename.php?x=1&y=2&z=3&myname=wombat

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

....filename.php?x=1&x=2&x=3&x=wombat

Legend has it that reading the manual never killed anyone.
My site

#5 ltoto

ltoto
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts

Posted 15 September 2006 - 02:42 PM

ahhh i think i understnad now, i think the only bit that confuses me is what i put before the 2nd id

#6 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 15 September 2006 - 02:56 PM

?Id=16&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
Legend has it that reading the manual never killed anyone.
My site

#7 ltoto

ltoto
  • Members
  • PipPipPip
  • Advanced Member
  • 162 posts

Posted 15 September 2006 - 03:01 PM

ahh yes, i accidently missed the first Id out which was confusing me, but it is working fine now, thanks a lot man




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users