Forum Moderators: coopster

Message Too Old, No Replies

format website link and email address in a table

         

nofia

6:22 pm on Jun 8, 2008 (gmt 0)

10+ Year Member



i have a table with columns
name
cwebsite
email address

i want to query and have listed in a table with 3 columns, the name, cwebsite and email address

i want the ablility to click on the website and be able to go to that site

i also want to click the email address and be able to send that name an email address if an email address was given

here is what i have for my website info and its not working, i think its a formatting issue but i'm not sure

Print "<td><center><font size= 2><a href=$info['cwebsite']>".$info['cwebsite']."</A></font></center></td>";

this is the error i'm getting

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING

thanks in advance for the help

StoutFiles

6:46 pm on Jun 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Assuming this is surrounded in php code.

?>

<td><center><font size= 2><a href=
<?php echo $info['cwebsite'];?>><?php echo $info['cwebsite'];?></A></font></center></td>

<?php

nofia

7:18 pm on Jun 8, 2008 (gmt 0)

10+ Year Member



thanks for the reply, but it didn't work, i'm new to this all and don't have php open close tags on each print line

here is my table result info how i have it now and yes its within php open and close tags already

<?php

while($info = mysql_fetch_array( $data ))

{
Print "<tr>";

Print "<td><center><font size= 2>".$info['cname'] . "</font></center></td>";

Print "<td><center><font size= 2>".$info['cwebsite']."</A></font></center></td>";

Print "<td><center><font size= 2>".$info['cemail'] . "</font></center></td>";

Print "</tr>";
}
?>

i want to be able to click on website and go to the website and click on email and send email to the address

thanks

g1smd

7:53 pm on Jun 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You don't want to be exposing real email addresses on any public page of a website, either as plain text or as a mailto: link.

Spammers will harvest them within days, and you'll very soon be receiving a deluge of junk.

You especially don't want to be publishing other people's email addresses without their permission.

nofia

8:29 pm on Jun 8, 2008 (gmt 0)

10+ Year Member



thanks for the reply g1smd

email addresses will only be show if the individual wants them to be and once finished testing and design it will be a members only site for the business i am in

do you know how to solve my problem

PHP_Chimp

9:10 pm on Jun 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Print "<td><center><font size= 2><a href=$info['cwebsite']>".$info['cwebsite']."</A></font></center></td>";

When you are using array's in echo or print statements you may find that it helps to put {}'s around the array. As otherwise php may decide that you meant $info as a variable and ['cwebsite'] as text.
So:

Print "<td><center><font size= 2><a href=[b]{[/b]$info['cwebsite'][b]}[/b]>".
$info['cwebsite'] // this is fine as you have broken out of print
."</A></font></center></td>";

Have a look at the array example under echo [uk2.php.net].
Its the same examples for print...just I have echo bookmarked (how sad is that...actually dont answer that ;)

Also you are starting your link with a, but ending it with A. You may want to choose upper or lowercase and stick to one or the other. Lowercase is xhtml compatible, so may be better in the long run. Not that this should make any difference to your error though.

[edited by: PHP_Chimp at 9:18 pm (utc) on June 8, 2008]

nofia

1:52 am on Jun 9, 2008 (gmt 0)

10+ Year Member



thanks php_chimp,
it worked

i love this website

jd