Colette Posted June 17, 2010 Share Posted June 17, 2010 Need to use a variable as the hyperlink destination. I'm getting an error: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in (refers to the second line of code here.) echo 'Message: ' . nl2br(htmlentities($row['message'])) . '<br />'; echo '<a href=\"$row['http']\">'$row['http']'</a>'; I can't seem to find the error. Tried all kind of variations. Link to comment https://forums.phpfreaks.com/topic/205055-echo-hyperlink-variable/ Share on other sites More sharing options...
MatthewJ Posted June 17, 2010 Share Posted June 17, 2010 echo "<a href=\"".$row['http']."\">".$row['http']."</a>"; Link to comment https://forums.phpfreaks.com/topic/205055-echo-hyperlink-variable/#findComment-1073404 Share on other sites More sharing options...
Pikachu2000 Posted June 17, 2010 Share Posted June 17, 2010 Second line isn't properly concatenated, and the escaping of the double quotes is unnecessary. echo '<a href="' . $row['http'] . '">' . $row['http'] . '</a>'; Link to comment https://forums.phpfreaks.com/topic/205055-echo-hyperlink-variable/#findComment-1073406 Share on other sites More sharing options...
Colette Posted June 17, 2010 Author Share Posted June 17, 2010 Perfect!! Thanks so much. I was really struggling with this one! Link to comment https://forums.phpfreaks.com/topic/205055-echo-hyperlink-variable/#findComment-1073407 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.