$name with link of $ID<

liunx

Guest
Hi all

I've got code that loops trough database for certan value, and if that value is in record, it gives back name and ID.

What I wanna do is to make link to another page and send value ID of that record to other variable.

It gives me back values of:

$name with link
$name with link
$name with link
$name with link

and what I wanna to be shown is:

Name with link
Name with link
Name with link
Name with link


$result = mysql_query("select Sifra_apartmana, Naziv_objekta from apartmani where iznajmljivac = '$broj'") or
die (mysql_error());
echo "<b>Naziv apartmana: </b>";
while ($row = mysql_fetch_array($result))
{

$name = $row["Naziv_objekta"];
$ID = $row["Sifra_apartmana"];

echo "<br>\n";
print ('<a href=http://www.htmlforums.com/archive/index.php/"izmjena_apartmana.php?ID='.urlencode($ID).'">$name</a>');// This lane makes name with link

}
mysql_free_result($result);
}



Hope I've explain problem.

thnxit happens because you put print with ' ' instead of " " ... do it like that:
print "<a href=http://www.htmlforums.com/archive/index.php/\".....\">$name</a>" it should work^ or


...
?>
<br>
<a href=http://www.htmlforums.com/archive/index.php/"izmjena_apartmana.php?ID=<?=urlencode($ID)?>">$name</a> <!-- This lane makes name with link -->
<?
...OR
print ('<a href=http://www.htmlforums.com/archive/index.php/"izmjena_apartmana.php?ID='.urlencode($ID).'">'.$name.'</a>');// This lane makes name with link
 
Back
Top