Page 1 of 1

embedding a parameter in a link to pass its value along

Posted: Wed Dec 22, 2010 11:14 am
by emelianenko
Hello everybody

I have got this line below. The id gets passed on alright, but I d need that the email is also passed to the closeup.php page. I must be putting something wrong in here. I invented the variable 'z, so I am not sure if I actually need it, I think I dont'. This is a row displayed out of a SQL query

Code: Select all


echo '<td><a href=closeup.php?id='.addslashes($row['id']) .'  &z="'.addslashes($row['email']).'" ><img src="'.htmlspecialchars($row['thumb']).'"></a> </td>';

would be very grateful if anybody could pick up what is incorrect in that email parameter that is not going through

regards

Re: embedding a parameter in a link to pass its value along

Posted: Wed Dec 22, 2010 11:28 am
by social_experiment
If you display something from the database use stripslashes(). As per the original question, are you retrieving the value of email from the database in your SQL query?

Re: embedding a parameter in a link to pass its value along

Posted: Wed Dec 22, 2010 12:10 pm
by emelianenko
yes, I am.

and just a few lines before I have the line I wrote

Re: embedding a parameter in a link to pass its value along

Posted: Wed Dec 22, 2010 12:36 pm
by AbraCadaver

Code: Select all

echo '<td><a href="closeup.php?id='.urlencode($row['id']).'&email="'.urlencode($row['email']).'">
<img src="'.htmlspecialchars($row['thumb']).'">
</a></td>';
Then on closeup.php

Code: Select all

echo $_GET['id'];
echo $_GET['email'];

Re: embedding a parameter in a link to pass its value along

Posted: Wed Dec 22, 2010 1:01 pm
by emelianenko
Thank you very much. Definitively this code does sound very fine, compared to what I had. Yes, the id continues being passed alright, but the email is still not being passed along and when I hover on the pic it displays equal to empty space =

however if I do this

Code: Select all

 echo '<td><font size="-1">' .htmlspecialchars($row['email']). '</font>'."</td>";
it shows fine on my page

but when put in that link it does not show on hovering and consequently it is not forwarded to the closeup.php page
, hmm dont know..

Re: embedding a parameter in a link to pass its value along

Posted: Wed Dec 22, 2010 1:05 pm
by AbraCadaver
emelianenko wrote:Thank you very much. Definitively this code does sound very fine, compared to what I had. Yes, the id continues being passed alright, but the email is still not being passed along and when I hover on the pic it displays equal to empty space =

however if I do this

Code: Select all

 echo '<td><font size="-1">' .htmlspecialchars($row['email']). '</font>'."</td>";
it shows fine on my page

but when put in that link it does not show on hovering and consequently it is not forwarded to the closeup.php page
, hmm dont know..
Sorry, in my posted code there is an errant double-quote after email:

[text]<td><a href="closeup.php?id='.urlencode($row['id']).'&email=" <--- delete that double-quote[/text]

Re: embedding a parameter in a link to pass its value along

Posted: Wed Dec 22, 2010 1:23 pm
by emelianenko
Bingo! Correct. That did the trick. The code is perfect now.

In the meantime I had a look at your website, spidean.com, which is very professional. Templates is something everybody is extremely interested in. My question, are they somehow related to Templates.com ?


best greetings

Emi

================================================================================================================================

Re: embedding a parameter in a link to pass its value along

Posted: Wed Dec 22, 2010 4:26 pm
by social_experiment
emelianenko wrote:yes, I am. and just a few lines before I have the line I wrote
Cool, next time paste all relevant code.

Re: embedding a parameter in a link to pass its value along

Posted: Wed Dec 22, 2010 9:06 pm
by AbraCadaver
emelianenko wrote:Bingo! Correct. That did the trick. The code is perfect now.

In the meantime I had a look at your website, spidean.com, which is very professional. Templates is something everybody is extremely interested in. My question, are they somehow related to Templates.com ?


best greetings

Emi

================================================================================================================================
Hi, thanks. No, I sell a theme engine that runs on some free CMSs and I resell http://templatemonster.com templates and some themes for my theme engine from http://portalthemes.com.