0

I want to display my data with a link functionality inside the php tag

<td><a href ="<? print $row->courier_url;?>"></a></td>

this is my code, Its not working.

5
  • 2
    Just put some value in a, it's working but you can't see it I guess. Commented Jul 10, 2013 at 12:37
  • Try {$row->courier_url}; and check for opening short tags, maybe better <?= than <? print. Also you need text to be clicked Commented Jul 10, 2013 at 12:37
  • "Its not working" Can you please be more descriptive? You should add some text inside the a tag, at least. Commented Jul 10, 2013 at 12:40
  • Use print_r to check whether key "courier_url" exist or not. Commented Jul 10, 2013 at 12:42
  • {$row->courier_url}; is from my database I use foreach($query as $row); Im using eclipse thats why its legal to use short tag like <? ?>. by the way its now working. Commented Jul 10, 2013 at 13:23

4 Answers 4

1
<td><a href ="<? echo $row->courier_url; ?>"><? echo $row->courier_url; ?> </a></td>
Sign up to request clarification or add additional context in comments.

Comments

0

I think this will work for you,

<td><a href ="<?=$row->courier_url; ?>"></a></td>

1 Comment

the data did not load on my table, its blank
0

First off, remove the space between href = so it's href=. Your php code is actually valid, does $row->courier_url actually print anything? How is $row being defined?

Also, don't use shorthand <? php tags use the full <?php. It's bad practice to use the shorthand version.

2 Comments

I try your first suggestion it did not load my data on my db, the data on $row->courier_url is http:\\Stackoverflow.com. Im using eclipse so its legal to use short tag.
short tags are legal sure, but it's bad practice. Just because something is supported doesn't mean you should use it. This has more info why you shouldn't use them: stackoverflow.com/questions/200640/… anyway, glad Marijke's answer helped you out
0

Try:

<td><a href ="<?=$row->courier_url;?>">Link</a></td>

5 Comments

my link is STACKOVERFLOW.COM but why the link go to localhost/STACKOVERFLOW.COM ???
use absolute url not relative like http://stackoverflow.com and not stackoverflow.com even better, <td><a href ="http://<?=$row->courier_url;?>">Link</a></td>
this <a href ="http://<?=$row->courier_url;?>"> is changed if that is what you are asking.
next question sir.. how can I add a scrollbar on my table??
Put your table in a div and add styling to the div see this link

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.