Title: PHP / echo / a href problem
Last modified: August 19, 2016

---

# PHP / echo / a href problem

 *  [fionagilbert](https://wordpress.org/support/users/fionagilbert/)
 * (@fionagilbert)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/php-echo-a-href-problem/)
 * Hi all,
 * Having a problem getting my echo & a href link working. The code below just gives
   me a white page when I upload.
 * I think I am doing some syntax wrong with the echo:
    [http://paste-it.net/public/xdc246f/](http://paste-it.net/public/xdc246f/)
 * But I don’t know what I’m doing wrong. Can you help?
 * Thanks,
    Fiona

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [codenextdoor](https://wordpress.org/support/users/codenextdoor/)
 * (@codenextdoor)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/php-echo-a-href-problem/#post-1337612)
 * Fiona,
    Try using single quotes to enclose what’s being echoed and double for
   the href – like this: `echo '<li><a href="<? the_permalink() ?>">'.$title.'</
   a></li>';`
 *  Thread Starter [fionagilbert](https://wordpress.org/support/users/fionagilbert/)
 * (@fionagilbert)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/php-echo-a-href-problem/#post-1337663)
 * Thanks for that.
 * That creates the link but not the permalink. It shows as ‘[http://domain.com/&lt](http://domain.com/&lt);?
   the_permalink() ?>’
 * Any suggestions?
 * Thank you
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/php-echo-a-href-problem/#post-1337667)
 * Try:
 * `echo '<li><a href="' . get_the_permalink() . '"' . $title. '"</a></li>";`
 *  Thread Starter [fionagilbert](https://wordpress.org/support/users/fionagilbert/)
 * (@fionagilbert)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/php-echo-a-href-problem/#post-1337708)
 * Hi esmi,
 * Get a white screen with your code. Strange. Can’t figure out what might me going
   amiss here.
 * Any further suggestions greatly appreciated.
 * Thanks
 *  Thread Starter [fionagilbert](https://wordpress.org/support/users/fionagilbert/)
 * (@fionagilbert)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/php-echo-a-href-problem/#post-1337714)
 * Hmmmmm,
 * The only way I have got this to work is by wrapping the ‘a href’ around the query
   like so:
 * [http://paste-it.net/public/a8b45b2/](http://paste-it.net/public/a8b45b2/)
 * Not sure if this is semantically correct but it works. Is this acceptable?
 * Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘PHP / echo / a href problem’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 3 participants
 * Last reply from: [fionagilbert](https://wordpress.org/support/users/fionagilbert/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/php-echo-a-href-problem/#post-1337714)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
