Hi all,
i am trying to print out a table from a database table and trying to make one of the fields a link to another webpage.
What i am trying to do is to make the last data in the row a link:
print "\t<td><font face=verdana size=2/><a href='http://www.cs.nott.ac.uk/Modules/0203/$var.html'>Full spec</a></font></td>\n";
The problem is i would like to enter a string variable as part of the hyperlink address. So in the example above i want to get $var to be recognised as part of the address. I have tried to concatentate like
print "\t<td><font face=verdana size=2/><a href='http://www.cs.nott.ac.uk/Modules/0203/' <? echo $var;?>.html'>Full spec</a></font></td>\n";
But i get a problem with the "" as it doesnt recognise the embedded PHP tags as it is already within PHP tags.
Can anyone help?????
Thank you for ur time.
Jos
interesting problem of trying to get string within hyperlink
Moderator: General Moderators
One thing that might work would be this :
Hope it works, goodluck.
Code: Select all
$url="http://www.site.com/path/{$var}.html";
print "\t <td> <font face=verdana size=2/> <a href={$url}>Full spec</a></font></td>\n";Re: interesting problem of trying to get string within hyper
This would have worked fine if you changed it slightly:josboogz wrote: print "\t<td><font face=verdana size=2/><a href='http://www.cs.nott.ac.uk/Modules/0203/' <? echo $var;?>.html'>Full spec</a></font></td>\n";
Code: Select all
print "\t<td><font face=verdana size=2/><a href='http://www.cs.nott.ac.uk/Modules/0203/'". $var ."html'>Full spec</a></font></td>\n";- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
If you want to have code formatting (ie. tabs and spaces) maybe you should consider using heredoc format:
http://www.php.net/manual/en/language.t ... ax.heredoc
Mac
http://www.php.net/manual/en/language.t ... ax.heredoc
Mac