Page 1 of 1

how to insert $ command in href fucntion to make it a link ?

Posted: Tue Jul 08, 2008 6:25 am
by azhan
hey guys...do anyone know how to write a href function code where by the text msg is actually my $ command ?
here's some of the code

<?php
.
.
.
.
.
.

$user = $_COOKIE['ID_my_site'];
$result = @mysql_query("SELECT title FROM pix WHERE pid ='$user'");
if (!$result) {
exit('<p>Error retrieving patient list from database!<br />'.
'Error: ' . mysql_error() . '</p>');
}
while ($list = mysql_fetch_array($result))
{
<a href="newpage.php">"'.$list['title'].'"</a>; <<<<<<------ THIS PART !!
}
?>


i know the href code above is wrong...so how do i create a href code where the msg is my $command function..and by the way href function doesnt seem to work out inside <?php ?> area...

HELP ME!

Azhan
________________________
http://www.productcoverdesign.com- "Cheapest E-cover Design"

Re: how to insert $ command in href fucntion to make it a link ?

Posted: Tue Jul 08, 2008 6:35 am
by sureshmaharana
Try this it works,

echo "<a href='newpage.php'>".$list['title']."</a>";

Re: how to insert $ command in href fucntion to make it a link ?

Posted: Tue Jul 08, 2008 6:50 am
by azhan
NICE!!!...it works!...thanks Suresh....but the link are totally too close with my previous echo

like this

Below are the title of the currently stored images, click on the name to viewzenith

where by "zenith" is the title that i call from database

how to i make it in the next line....not in the same line


thanks!

Re: how to insert $ command in href fucntion to make it a link ?

Posted: Tue Jul 08, 2008 7:39 am
by sureshmaharana
Just use this one.

echo "<a href='newpage.php'>".$list['title']."</a><br>";