Dracolas Posted December 15, 2009 Share Posted December 15, 2009 Ok so i'm doing a members page on my site and i had it all working until I wanted to make it link to the profile page... here's the code i'm using to do this echo "<td><a href="http://dracolas.comli.com/clan/profile.php?username=$username">$username</a></td>"; i know that $username is working correctly because when I use just echo "$username" it works fine.. but the other way I keep getting Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' Why is this? Quote Link to comment https://forums.phpfreaks.com/topic/185268-link-in-table-help-needed/ Share on other sites More sharing options...
teamatomic Posted December 16, 2009 Share Posted December 16, 2009 escape the inside quotes "this \"is\" it" Quote Link to comment https://forums.phpfreaks.com/topic/185268-link-in-table-help-needed/#findComment-978168 Share on other sites More sharing options...
Dracolas Posted December 22, 2009 Author Share Posted December 22, 2009 Ok either i didn't do it right or it's not working. Your telling me to do a href=\"URL"\ Right? Quote Link to comment https://forums.phpfreaks.com/topic/185268-link-in-table-help-needed/#findComment-982522 Share on other sites More sharing options...
premiso Posted December 22, 2009 Share Posted December 22, 2009 echo "<td><a href=\"http://dracolas.comli.com/clan/profile.php?username=$username\">$username</a></td>"; Is what he is telling you to do. Quote Link to comment https://forums.phpfreaks.com/topic/185268-link-in-table-help-needed/#findComment-982524 Share on other sites More sharing options...
FaT3oYCG Posted December 23, 2009 Share Posted December 23, 2009 A better method would be to use single quotes and then you are able to use the doubble quotes inside them for html, any variables should be concatinated. Quote Link to comment https://forums.phpfreaks.com/topic/185268-link-in-table-help-needed/#findComment-983053 Share on other sites More sharing options...
haku Posted December 23, 2009 Share Posted December 23, 2009 I prefer that method, but it's really a matter of personal preference. Quote Link to comment https://forums.phpfreaks.com/topic/185268-link-in-table-help-needed/#findComment-983078 Share on other sites More sharing options...
lAZLf Posted December 24, 2009 Share Posted December 24, 2009 Simplest way would be: echo "<td><a href='http://dracolas.comli.com/clan/profile.php?username=$username'>$username</a></td>"; You see, when you did: echo "<td><a href="http://dracolas.comli.com/clan/profile.php?username=$username">$username</a></td>"; the quotes in the html you want to print cut off the echo function, meaning that the URL "http://dracolas.comli.com/clan/profile.php?username=$username" is going to be cut off, which is a big syntax error. Quote Link to comment https://forums.phpfreaks.com/topic/185268-link-in-table-help-needed/#findComment-983840 Share on other sites More sharing options...
haku Posted December 25, 2009 Share Posted December 25, 2009 Unfortunately, your simplest way won't work well with all browsers. Some of them don't like single quotes around attribute names. Quote Link to comment https://forums.phpfreaks.com/topic/185268-link-in-table-help-needed/#findComment-983877 Share on other sites More sharing options...
Dracolas Posted December 28, 2009 Author Share Posted December 28, 2009 ty guys. i used echo "<td><a href=\"http://dracolas.comli.com/clan/profile.php?username=$username\">$username</a></td>"; and it's working fine now. TY Quote Link to comment https://forums.phpfreaks.com/topic/185268-link-in-table-help-needed/#findComment-985030 Share on other sites More sharing options...
SuperBlue Posted December 30, 2009 Share Posted December 30, 2009 Unfortunately, your simplest way won't work well with all browsers. Some of them don't like single quotes around attribute names. Thats actually incorrect, using either single or double quotes would be fine, also in XHTML. Quote Link to comment https://forums.phpfreaks.com/topic/185268-link-in-table-help-needed/#findComment-986058 Share on other sites More sharing options...
SuperBlue Posted December 30, 2009 Share Posted December 30, 2009 Ok maybe i sounded a bit rude, I'm sorry for that. I have been looking around, just to be sure, and can't seem to find a single reference to which browser actually dosen't support single quotes. After all they been in the spec since like for ever, the earliest reference i found was http://www.w3.org/MarkUp/html-spec/html-spec_3.html#SEC3.2.4 :-\ Quote Link to comment https://forums.phpfreaks.com/topic/185268-link-in-table-help-needed/#findComment-986080 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.