Page 1 of 1

pass multiple variables in URL?

Posted: Sun Jul 29, 2007 4:30 pm
by gregorious
This is probably a no brainer for most of you.

I know how to pass one variable through a url, but how do I pass multiple variables?

This is a no go.

[ <a href='edit_residential_image.php?id=$id;&imageid=$imageid'><strong>edit</strong></a> ]

I need to pass image ID and the residential ID.
Thanks in advance for any help.

Posted: Sun Jul 29, 2007 4:36 pm
by spamyboy
Here you go:

Code: Select all

example.php?oneVariable=something&secondVariable=something&thinrdVariable=something

Posted: Sun Jul 29, 2007 4:45 pm
by webgroundz
here's another example :

i think you forgot to include the <?php ?> in your variable, it should be look like this:
instead of using = sign, you can use

Code: Select all

<?php echo $id; ?>
to print your variable.

<a href='edit_residential_image.php?
id =

Code: Select all

<?php =$id ?>
&imageid =

Code: Select all

<?php =$imageid ?>
'>redirect</a>


:wink: :) :D

Posted: Sun Jul 29, 2007 5:00 pm
by spamyboy
or...

Code: Select all

<?=$var?>

Thanks guys; that is a big help!

Posted: Sun Jul 29, 2007 5:25 pm
by gregorious
Here is the fix for future readers!
I have been reading else where that "&" is better than "&".

Code: Select all

[ <a href='edit_residential_image.php?id=$id&imageid=$imageid'><strong>edit</strong></a> ]
Thanks guys; that is a big help!

Posted: Sun Jul 29, 2007 7:00 pm
by superdezign
spamyboy wrote:or...

Code: Select all

<?=$var?>
NO! NO NO NO NO NO!
Short tags == outdated? True.
:P

Re: Thanks guys; that is a big help!

Posted: Sun Jul 29, 2007 7:13 pm
by SidewinderX
gregorious wrote:I have been reading else where that "&" is better than "&".
Care to elaborate why or post that source?

Re: Thanks guys; that is a big help!

Posted: Sun Jul 29, 2007 7:19 pm
by superdezign
SidewinderX wrote:
gregorious wrote:I have been reading else where that "&" is better than "&".
Care to elaborate why or post that source?
He is completely correct. & is the standard set by W3C. Don't believe me? Try to validate your HTML.