PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
db579
Forum Commoner
Posts: 37 Joined: Sun Jul 18, 2010 6:23 pm
Post
by db579 » Sat Aug 07, 2010 10:07 am
I'm using links like
and the using GET to to obtain whether or not $example has been set by clicking the link and what it has been set as.
An example is:
Code: Select all
$album = (isset($_GET['album']) ? $_GET['album']:'');
$Array = scandir("gallery");
foreach($Array as $directory){
echo "<a href='?album=$directory'>$directory</a>";
}
?>
How I do this for several variables in one link? Have tried googling but can't seem to find the right syntax anywhere. Thanks very much
Weirdan
Moderator
Posts: 5978 Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine
Post
by Weirdan » Sat Aug 07, 2010 12:44 pm
Code: Select all
<a href="?var1=something&var2=somethingElse">click</a>
Code: Select all
<a href="?<?php echo http_build_query(array('var1' => 'something',
'var2' => 'somethingElse'),
'', '&')?>">click</a>
db579
Forum Commoner
Posts: 37 Joined: Sun Jul 18, 2010 6:23 pm
Post
by db579 » Sat Aug 07, 2010 1:02 pm
Thank you very much! Was literally tearing my brains out over this but that works perfectly!