Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    single quote issue

    str=encodeURIComponent(str);
    ajaxRequest.open("GET", "scr/scr_edit.php?str="+str, true);

    on my local server i get this on the php page "<p>\'test\'</p>" but only my live sever i get this "<p>'test'</p>". i dont understand why it is different and it is a problem for "sql input text tidy up function" i now have to check what sever im on etc.

    anyone have any thoughts/ideas? its more annoying than anything to be honest.

  • #2
    Regular Coder
    Join Date
    Feb 2007
    Posts
    113
    Thanks
    6
    Thanked 1 Time in 1 Post
    You need to be more speciffic, nobody will understand what you're asking from your post. What code are you running?

  • #3
    New to the CF scene
    Join Date
    Apr 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    AJAX
    function saveEdit(){
    var ajaxRequest; // The variable that makes Ajax possible!
    try{
    // Opera 8.0+, Firefox, Safari
    ajaxRequest = new XMLHttpRequest();
    // alert('Opera 8.0+, Firefox, Safari');
    }catch (e){
    // Internet Explorer Browsers
    try{
    ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    //alert('Msxml2.XMLHTTP');
    }catch (e) {
    try{
    ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
    //alert('Microsoft.XMLHTTP');
    }catch (e){
    // Something went wrong
    alert("Your browser broke!");
    return false;
    }
    }
    }
    // Create a function that will receive data
    // sent from the server and will update
    // div section in the same page.
    ajaxRequest.onreadystatechange = function(){
    //alert(ajaxRequest.readyState);
    if(ajaxRequest.readyState == 4){
    if(ajaxRequest.status == 200) {
    // ajaxDisplay.innerHTML = ajaxRequest.responseText;
    //alert(ajaxRequest.responseText);
    }else {
    ajaxDisplay.innerHTML = ajaxRequest.status;
    //document.ajax.dyn="Error code " + xhr.status;
    }
    }
    }
    var str=document.getElementById('str').value;
    str=encodeURIComponent(str);
    ajaxRequest.open("GET", "scr/scr_edit.php?str="+str, true);
    ajaxRequest.send(null);
    }

    basically what i am saying is $_GET['str']="<p>\'test\'</p>" on one server and $_GET['str']="<p>'test'</p>", where the input field contains "<p>'test'</p>" on both. a back-slash is prefixed to the ' on one server and not the other.

    PHP(scr/scr_edit.php)
    echo $_GET["str"];

    it isnt a problem i can't overcome, i just dont understand why its happening.
    Last edited by discobear; 11-04-2008 at 04:36 PM.


  •  

    Posting Permissions

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