...

View Full Version : single quote issue



discobear
11-03-2008, 10:16 AM
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.

eapro
11-03-2008, 07:58 PM
You need to be more speciffic, nobody will understand what you're asking from your post. What code are you running?

discobear
11-04-2008, 04:18 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum