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

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
azhan
Forum Commoner
Posts: 68
Joined: Fri Jun 27, 2008 6:05 am

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

Post 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"
sureshmaharana
Forum Commoner
Posts: 30
Joined: Thu Jul 03, 2008 4:20 am
Contact:

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

Post by sureshmaharana »

Try this it works,

echo "<a href='newpage.php'>".$list['title']."</a>";
azhan
Forum Commoner
Posts: 68
Joined: Fri Jun 27, 2008 6:05 am

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

Post 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!
sureshmaharana
Forum Commoner
Posts: 30
Joined: Thu Jul 03, 2008 4:20 am
Contact:

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

Post by sureshmaharana »

Just use this one.

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