Page 1 of 1

send a variable in a url

Posted: Tue Dec 01, 2009 6:01 am
by chris_s_22
in this script i connect to database and start session
from the search form collects data checks it the gets the appropriate data from database.
then displays it using code below

Code: Select all

 
while($row=mysql_fetch_array($result)) 
{
$userid = $row["id"];
$photo = $row["photo"];
echo "<td><img src='http://www.url.co.uk/images/$photo'>";
echo '<a href='view.php?userid=$userid'>' . $row['username'] . '</a>';
echo '<strong>Location:</strong>' . $row['location'] . '<br>';
echo '<strong>Date of Birth:</strong>' . $row['dob'] . '</td>';
} 
 
If you look particulary at this part im trying to send the id data recieved from database to the view.php

Code: Select all

 
echo '<a href='view.php?userid=$userid'>' . $row['username'] . '</a>';
 
Can yopu tell me the correct way to do this

Re: send a variable in a url

Posted: Tue Dec 01, 2009 10:21 am
by AbraCadaver

Re: send a variable in a url

Posted: Tue Dec 01, 2009 10:49 am
by chris_s_22
figured it out thx