Re: trying to output a hyperlink

From: Date: Sun, 11 Apr 2004 06:09:15 +0000
Subject: Re: trying to output a hyperlink
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-183113@lists.php.net to get a copy of this message
When in doubt, view source. :) As John has already mentioned, you need text between the two tags to actually display in the browser. You probably would've seen your mistake a lot sooner if you viewed the page source when you first tried it out. Also, you can save yourself some time using PHP's shorthand concatenation operator.
<td><?php $link = '<a href="' ;
              $link = $link . $row[2] . '">' ;
              $link = $link . '</a>' ;
              echo $link ; ?></td>
Turns into: <td><?php $link = '<a href="'; $link .= $row[2] . '">'; $link .= 'Click here</a>'; echo $link; ?></td> Although, it could be shortened even more, to: <td><?php $link = "<a href=\"".$row[2]."\">Click here</a>"; echo $link;?></td> But I imagine you're doing it with more lines for legibilities' sake. Andy Damian Brown wrote:
<td><?php $link = '<a href="' ;
              $link = $link . $row[2] . '">' ;
              $link = $link . '</a>' ;
              echo $link ; ?></td>
is not working, I want to output $row[2] as a hyperlink as it is the refering URL, but the above is just showing blank in the output, with no link and no text in the output table -- www.phpexpert.org/truefaith.htm "True Faith is not just when you believe in God and yourself, it is when others begin to believe in you as well" - Damian John Paul Brown 2004


« previous php.general (#183113) next »