Forums / General Questions / PHP code problem

PHP code problem

Locked

Started by shabizon on 16 Nov 2010, 10:27 PM · Views: 683

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
16 Nov 2010, 10:27 PM
#1
shabizon avatar

shabizon

New Zenner

Join Date:
Oct 2010
Posts:
68
Plugin Contributions:
0

PHP code problem

Hello, I want to put some sort of html code to one to my Php file.

But my html include ' ' characters and when I try to load my online cart it won't let me.

So I just want to ask if there is any way to let the PHP file accept ' ' Characters.

Kind regards,
Aaron.

16 Nov 2010, 10:47 PM
#3
shabizon avatar

shabizon

New Zenner

Join Date:
Oct 2010
Posts:
68
Plugin Contributions:
0

Re: PHP code problem

gjh42:

Escape your ' characters with a backslash \ to keep them from interfering with the PHP code.

'

But the ' Characters is part from the function, I can't ignore this Characters

16 Nov 2010, 11:20 PM
#4
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: PHP code problem

Post an example of the HTML you want to use, and the file section where you want to put it, and I will show you how to use the escapes.

You can also use double quotes " for HTML inside single-quoted ' PHP strings and they will not interfere with each other.

16 Nov 2010, 11:42 PM
#5
shabizon avatar

shabizon

New Zenner

Join Date:
Oct 2010
Posts:
68
Plugin Contributions:
0

Re: PHP code problem

Double Quotes not good for this function:

<script type="text/javascript">var script = document.createElement("script");script.type="text/javascript";var src = "server.php?request=track&output=jcrpt&nse="+Math.random();setTimeout("script.src=src;document.getElementById('tracking').appendChild(script)",1);</script>

('tracking') this is important part from the function.

17 Nov 2010, 1:43 AM
#6
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,874
Plugin Contributions:
8

Re: PHP code problem

The code you show is already using alternate nesting quote types - double for most, single for the 'tracking' inside
("script.src=src;document.getElementById('tracking').appendChild(script)",1)

If you cannot escape those like ('tracking'), you may need to use double quotes for the PHP and escape all of the HTML double quotes.

17 Nov 2010, 7:44 AM
#7
shabizon avatar

shabizon

New Zenner

Join Date:
Oct 2010
Posts:
68
Plugin Contributions:
0

Re: PHP code problem

Please Explain yourself better if I will do like this ('tracking')
The function now work as well and the same with double quotes.

There is another way?