Jump to content

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

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.