Hi,
when doing loop output statements using data from mysql and i'm printing html I have to do attribute values without quote marks, the php confuses them with ones in its own code. I know you can do attributes without quotes but this is not good html. Is there a way around this?
I tried using the & quote ; (without spaces) but this does not work inside html elements.
printing HTML
Moderator: General Moderators
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Have a read of:
http://www.php.net/manual/en/language.types.string.php
Basically, you can do:
or
or
or exit out of the PHP and do the HTML that way.
Mac
http://www.php.net/manual/en/language.types.string.php
Basically, you can do:
Code: Select all
echo '<a href="test.php?id='.$ID.'">link</a>';Code: Select all
echo "<a href="test.php?id=$ID">link</a>"Code: Select all
echo <<<END
<a href="test.php?id=$ID">link</a>
END;Mac
- knmwt15000
- Forum Newbie
- Posts: 8
- Joined: Thu Apr 25, 2002 9:51 am
Code: Select all
printf('<a href="test.php?id=%s">link</a>',$ID);- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
Don't use printf() unless you need to format the output - used as it is above it's fairly redundant.Friday wrote:Code: Select all
printf('<a href="test.php?id=%s">link</a>',$ID);
Mac