Jump to content

link in table help needed


Dracolas

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/185268-link-in-table-help-needed/
Share on other sites

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.

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  :-\

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.