% sign!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

% sign!

Post by spacebiscuit »

Hi,

I am using 'define' to print a message to the screen which includes the % sign:

define('TEXT_ORDER_FORCED_QUANTITY_AMOUNT', 'Your current order qualifies for a 12 percent discount');

I am having to use wording in place of the % sign as if I use the sign the page will not parse correctly. I have tried using a forward and back slash to escape the % sign but this does not work. How is it done?

Thanks,

Rob.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

maybe use it's entity value?
replace % with & #37; and let me know what happens. (take out the space between & and #)

(I'm not sure I understand your question, but try it anyway)
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

I'm not sure what you mean by 'parse correctly'. Is the PHP parser throwing errors or does the resulting HTML page not render properly?

If your problem is the former, the PHP errors should guide you. If it's the latter, do what ~TNSG said & replace it with it's character code.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Post by spacebiscuit »

Thanks for the replies....

I don't have the error output switched on my server - I just get a blank white page which is what usually happens when there is an error on my page.

I tried substituting '& #37;' for '%' but this just outputs '& #37;' to the screen and not the sign!

How easy is it to swtich the error output on, perhaps this will help narrow the problem down?

An odd one!

Rob.
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post by Luke »

I told you to take out the space between the & and the #

Code: Select all

%
spacebiscuit
Forum Contributor
Posts: 390
Joined: Mon Mar 07, 2005 3:20 pm

Post by spacebiscuit »

Works perfectly - thanks!

Rob.
Post Reply