problem with variable

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

Post Reply
User avatar
orangeapple
Forum Commoner
Posts: 70
Joined: Tue Jan 06, 2004 1:24 pm
Location: Geneva / Switzerland

problem with variable

Post by orangeapple »

Hi everyone !

i have a problem :

header("Location: norestric1.php?randompass=$randompass");

this works perfectly, it sends the value of $randompass to norestric1.php
wereas this :

<a href="logmon.php?randompass=$randompass"><img src="../media/bouton_loginmonitoring.jpg" width="130" height="25" border="0">

doesn't send the value of the variable but sends :

http://steph/microsent/pages/logmon.php ... randompass

who can help ?
Thanks !
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

Are you sure that

Code: Select all

<a href="logmon.php?randompass=$randompass"><img src="../media/bouton_loginmonitoring.jpg" width="130" height="25" border="0">
is inside the PHP tags? If it's not you will have to do:

Code: Select all

<a href="logmon.php?randompass=<?php echo $randompass; ?>"><img src="../media/bouton_loginmonitoring.jpg" width="130" height="25" border="0">
User avatar
orangeapple
Forum Commoner
Posts: 70
Joined: Tue Jan 06, 2004 1:24 pm
Location: Geneva / Switzerland

Post by orangeapple »

yes, these codes are inside the PHP tags...
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

<a href="logmon.php?randompass=$randompass">
You've used single quotes to wrap it, e.g.
echo '<a href="$bar">'; .. that will not work..
either
echo "<a href=\"$bar\">"; ... or
echo '<a href="'.$bar.'">';
Post Reply