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.

  • 2
    Just put some value in `a`, it's working but you can't see it I guess. – Karo Jul 10 '13 at 12:37
  • Try `{$row->courier_url};` and check for opening short tags, maybe better `=` than ` print`. Also you need text to be clicked – Royal Bg Jul 10 '13 at 12:37
  • "Its not working" Can you please be more descriptive? You should add some text inside the `a` tag, at least. – Sharlike Jul 10 '13 at 12:40
  • Use print_r to check whether key "courier_url" exist or not. – saran banerjee Jul 10 '13 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. –  Jul 10 '13 at 13:23

4 Answers4

1
<td><a href ="<? echo $row->courier_url; ?>"><? echo $row->courier_url; ?> </a></td>
Matheno
  • 4,112
  • 6
  • 36
  • 53
0

I think this will work for you,

<td><a href ="<?=$row->courier_url; ?>"></a></td>
n8coder
  • 691
  • 4
  • 12
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.

Novocaine
  • 4,692
  • 4
  • 44
  • 66
  • 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. –  Jul 10 '13 at 13:19
  • 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: http://stackoverflow.com/questions/200640/are-php-short-tags-acceptable-to-use anyway, glad Marijke's answer helped you out – Novocaine Jul 10 '13 at 13:42
0

Try:

<td><a href ="<?=$row->courier_url;?>">Link</a></td>
Nil'z
  • 7,487
  • 1
  • 18
  • 28