Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-03-2008, 07:47 PM   PM User | #1
2Pacalypse
New Coder

 
Join Date: Jul 2008
Posts: 96
Thanks: 4
Thanked 0 Times in 0 Posts
2Pacalypse has a little shameless behaviour in the past
PHP Error

PHP Code:
if($ir['user_level'] > 1)
{
print 
"<br />
"
<a href='donator.php'>Donate</a> for game benifits"<br />
;} 
Can anyone tell me what is wrong with this?

It isn't the exact finished bit so don't worry about it being wrong... it saying a few things I don't even understand...
2Pacalypse is offline   Reply With Quote
Old 08-03-2008, 07:55 PM   PM User | #2
croatiankid
Regular Coder

 
croatiankid's Avatar
 
Join Date: Jan 2006
Posts: 665
Thanks: 1
Thanked 12 Times in 12 Posts
croatiankid is on a distinguished road
You have to escape the quotes like so:
PHP Code:
<?php
if($ir['user_level'] > 1

print 
"<br /> 
\"<a href='donator.php'>Donate</a> for game benifits\"<br />"
;} 

?>
__________________
Hrvoje
Croatiankid designs
Downtown host
croatiankid is offline   Reply With Quote
Old 08-03-2008, 07:55 PM   PM User | #3
djm0219
Senior Coder

 
djm0219's Avatar
 
Join Date: Aug 2003
Location: Wake Forest, North Carolina
Posts: 1,229
Thanks: 2
Thanked 190 Times in 188 Posts
djm0219 is on a distinguished road
The way you've got things in quotes is most of the problem.

PHP Code:
if($ir['user_level'] > 1)
{
print 
'<br /><a href="donator.php">Donate</a> for game benifits<br />';

Values for HTML tags have to be enclosed in double quotes not single quotes.

If you want the entire sentence quoted use:

PHP Code:
if($ir['user_level'] > 1)
{
print 
'<br />"<a href="donator.php">Donate</a> for game benifits"<br />';

__________________
Dave .... HostMonster for all of your hosting needs

Last edited by djm0219; 08-03-2008 at 07:56 PM.. Reason: Added 2nd example after seeing previous post
djm0219 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:46 PM.


Advertisement
Log in to turn off these ads.