Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2010
    Posts
    69
    Plugin Contributions
    0

    Default 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.

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    21,092
    Plugin Contributions
    25

    Default Re: PHP code problem

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

    \'

  3. #3
    Join Date
    Oct 2010
    Posts
    69
    Plugin Contributions
    0

    Default Re: PHP code problem

    Quote Originally Posted by gjh42 View Post
    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

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    21,092
    Plugin Contributions
    25

    Default 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.

  5. #5
    Join Date
    Oct 2010
    Posts
    69
    Plugin Contributions
    0

    Default 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.sr c=src;document.getElementById('tracking').appendChild(script)",1);</script>


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

  6. #6
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    21,092
    Plugin Contributions
    25

    Default 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.

  7. #7
    Join Date
    Oct 2010
    Posts
    69
    Plugin Contributions
    0

    Default 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?

  8. #8
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    21,092
    Plugin Contributions
    25

    Default Re: PHP code problem

    I think it will work, but I haven't tried it in that particular circumstance. Try it and see.

 

 

Similar Threads

  1. Sidebox Code Problem
    By lasilhouette in forum General Questions
    Replies: 5
    Last Post: 31 Jan 2009, 03:20 PM
  2. OSC mod porting - more help please - another code problem
    By strelitzia in forum Contribution-Writing Guidelines
    Replies: 0
    Last Post: 31 Oct 2007, 07:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •