/    Sign up×
Community /Pin to ProfileBookmark

passing more than one variable via url

I need to pass 3 variables through url to use the values in the next page. Is the following correct? it doesn’t work for me

[code=php]while ($i = mysql_fetch_assoc($result)){

echo “<tr><td>”.$i[“s_id”].”</td>”;
echo “<td>”.$i[“s_reg”].”</td>”;
echo “<td>”.$i[“r_no”].”</td>”;

echo “<td><a href=pag3.php?u_sid=”.$i[“s_id”].”u_sreg=”.$i[“s_reg”].”u_rno=”.$i[“r_no”].”>select</a></td></tr>”;[/code]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@LuboxAug 13.2006 — First thing I see is a missing '&' between the variables:

[code=php]
echo "<td><a href=pag3.php?u_sid=".$i["s_id"]."&u_sreg=".$i["s_reg"]."&u_rno=".$i["r_no"].">select</a></td></tr>";

[/code]


Maybe that is all?
Copy linkTweet thisAlerts:
@memeauthorAug 13.2006 — Yes that's all, the & solved my problem and I can retrieve the variables in the next page?

many thanks
Copy linkTweet thisAlerts:
@pcthugAug 13.2006 — To comply with W3C standards, you should use the $amp; entity
[code=php]while ($i = mysql_fetch_assoc($result)){

echo "<tr><td>".$i["s_id"]."</td>";
echo "<td>".$i["s_reg"]."</td>";
echo "<td>".$i["r_no"]."</td>";

echo "<td><a href=pag3.php?u_sid=".$i["s_id"]."&amp;u_sreg=".$i["s_reg"]."&amp;u_rno=".$i["r_no"].">select</a></td></tr>";[/code]
Copy linkTweet thisAlerts:
@memeauthorAug 14.2006 — Hi there,

I think my requirment for passing variables via url is getting more complex now. I wonder if you can help.

Instead of hyperlink to the next page as posted earlier. I am now using tick boxes

the while loop below can return 1 to 3 rows. The user tick the boxes for the rows they want. I want to be able to pass variables for all the rows where the tickbox is checked to the next page; is this possible. I am currently able to pass values from one row only using a hyper link as follows:

[code=php]while ($i = mysql_fetch_assoc($result)){

echo "<tr><td>".$i["s_id"]."</td>";
echo "<td>".$i["s_reg"]."</td>";
echo "<td>".$i["r_no"]."</td>";

echo "<td><a href=pag3.php?u_sid=".$i["s_id"]."&amp;u_sreg=".$i["s_reg"]."&amp;u_rno=".$i["r_no"].">select</a></td></tr>"; [/code]


but I am now using tickboxes and need to pass the variables for all rows returned:

[code=php]while ($i = mysql_fetch_assoc($result)){

echo "<tr><td>".$i["s_id"]."</td>";
echo "<td>".$i["s_reg"]."</td>";
echo "<td>".$i["r_no"]."</td>";

echo "<td><form action='page3.php' method=post><input type='checkbox' name ='booking' ></td></tr>";[/code]


Rescue me!
×

Success!

Help @meme spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.15,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...