View Full Version : sending 2 id's
simjay
05-16-2007, 02:15 PM
<a href='vote.php?name_id=$name_id?$vote_number=1'>1</a>
how would i send $name_id and $vote_number to vote.php
Thank you
rafiki
05-16-2007, 02:18 PM
$name_id = $_GET['name_id'];
$vote_number = $_GET['votenumber'];
??
Pennimus
05-16-2007, 03:13 PM
To send more than one piece of information in a query string use an ampersand to seperate each name and value pair.
<a href="vote.php?name_id=$name_id&$vote_number=1">1</a>
And if $name_id and $vote_number are PHP variables you'll need to echo them:
<a href="vote.php?name_id=<?php echo $name_id;?>&<?php echo $vote_number;?>=1">1</a>
BonRouge
05-16-2007, 03:20 PM
&
aedrin
05-16-2007, 05:24 PM
To fully explain the previous post, when you're creating a URL, instead of just using the & you should be using &, like this.
<a href="file.php?var1=value&var2=value">Link</a>
If all your links pass through a function (always a healthy idea), then this can be fixed easily by a str_replace() call.
rafiki
05-16-2007, 07:24 PM
ahh i didnt see that he used anouther ? to define the next var
maybe i should read closer next time :(
JohnDubya
05-16-2007, 08:20 PM
To fully explain the previous post
And to further explain, the reason you use & instead of just & is because of the new XHTML markup rules. There are certain methods of coding that are being done away with, and using certain symbols is one of them. You can validate your page to make sure it is abiding by the "rules" by going to:
http://validator.w3.org/
felgall
05-16-2007, 08:55 PM
& < and > all have special meanings in HTML and so where you want to use one of those characters you need to use the entity code equivalents which are & < and > respectively. Anything starting with & is an entoty code.
JohnDubya
05-16-2007, 08:59 PM
And here's a site that lists out special characters and their codes to use in place of them.
http://www.webmonkey.com/reference/special_characters/
aedrin
05-16-2007, 09:01 PM
is because of the new XHTML markup rules
I was of the thought that this was part of HTML as well. Just that no one ever followed it.
JohnDubya
05-16-2007, 09:50 PM
I'm not for sure. I haven't heard anything about HTML in years. I've only heard XHTML talked about. *shrug*
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.