Jump to content

getting a query field to display as a hyperlink


Plamph
 Share

Recommended Posts

Hi,

 

I am new to the boards and php and mysql.

 

I have created a database and can add entries via a form. I can query the database with another form and get the results to display in a table.

 

All good so far as that is what I was hoping to achieve but one of the fields I want to display as a hyperlink but I am having problems with the syntax as I keep getting errors when I try to wrap the variables in  <a href > tag.

 

<tr>
<td><?php echo $fquery['prefix']; echo $fquery['website']; ?><?php echo $fquery['website']; ?></td>
</tr>


now that displays e.g. http://www.example.comwww.example.com.

so I feel I am nearly there I just need advice as to how to construct a hyperlink from the fields queried.

 

 

Link to comment
Share on other sites

Hi like normal HTML but when you need to break into the php variable to break the html with apostrophe + comma then after the variable back into the HTML with comma + apostrophe

 

echo'<a href="',$fquery['website'],'">',$fquery['website'],'<a/>';

 

 

Link to comment
Share on other sites

Hi like normal HTML but when you need to break into the php variable to break the html with apostrophe + comma then after the variable back into the HTML with comma + apostrophe

 

echo'<a href="',$fquery['website'],'">',$fquery['website'],'<a/>';

 

 

 

Except you use periods not commas.

Link to comment
Share on other sites

Hi like normal HTML but when you need to break into the php variable to break the html with apostrophe + comma then after the variable back into the HTML with comma + apostrophe

 

echo'<a href="',$fquery['website'],'">',$fquery['website'],'<a/>';

 

 

 

Except you use periods not commas.

 

commas are fine.

Link to comment
Share on other sites

This thread is more than a year old.

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.

 Share

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