Geo877 Posted May 15, 2008 Share Posted May 15, 2008 I'm sure this problem is relatively easy to solve but i'm all out of ideas... Ok i'm building a kind of primitive blog editing thingy for my site, you're able to add, edit and move side boxes and it all works fine but, in order to store the temporary data while the user is editing and refreshing the page i put the variables in the url and the page looks for them with php upon loading, this work totally fine until i start using quotation marks in the temporary data. The Url looks a lot like this - http://192.168.2.2:81/Site/editR.php?sid=fd9b1af77a234e8522ed52ba0c062448&update=true&Rightcount=3&title1=Login&content1=&class name1=login&title2=Example%20Box%20%22&content2=Example%20%22%22%20'%20/&classname2=box2 it probably isn't the best way of sending data but tbh i'm not the best php user. Anyway so when i write text in a content box and run a function that requires the page to reload the pages grabs the data from the content box and puts it in the URL, Fine until i put quotation marks in the content box they appear in the URL as %22 when this is sent back to the page it appears as /" . If i were to reload it would appear as ///" . Why :s I don't know if the problem is in the sending or receiving of the data, any advice is appreciated heres some snippets if they help... PHP receiving for ( $x = 1; $x <= $RightCount; $x += 1) { $newData = $_GET['classname'.$x]; ${'RightClass'.$x} = $newData; if($newData=='login'){ ${'RightVisibleTo'.$x} = 'publicO'; } if(!$newData){ ${'RightClass'.$x} = "box2"; } $newData = $_GET['content'.$x]; ${'RightContent'.$x} = $newData; if(!$newData){ ${'RightContent'.$x} = "New Box".$x; } $newData = $_GET['title'.$x]; ${'RightTitle'.$x} = $newData; if(!$newData){ ${'RightTitle'.$x} = "New Box".$x; } } Javascript / PHP sending function remove(){ window.location.href="<?php echo($_SERVER['PHP_SELF'].$sid."&update=true&Rightcount=".($RightCount-1)); for ( $b = 1; $b <= $RightCount; $b += 1) { echo("&title".$b."=".'"+document.form.title'.$b.'.value+"'); echo("&content".$b."=".'"+document.form.content'.$b.'.value+"'); echo("&classname".$b."=".'"+document.form.class'.$b.'.options[document.form.class'.$b.'.se lectedIndex].value+"'); } ?>"; } Thanks! Link to comment https://forums.phpfreaks.com/topic/105786-big-problem-with-quotes/ Share on other sites More sharing options...
craygo Posted May 15, 2008 Share Posted May 15, 2008 when you want to add the data to display it on the browser you will have to use stripslashes() to display the data in the content box. magic quotes is on by default so your data gets passed with slashes in front of special characters in order to "escape" them. Ray Link to comment https://forums.phpfreaks.com/topic/105786-big-problem-with-quotes/#findComment-542101 Share on other sites More sharing options...
Geo877 Posted May 15, 2008 Author Share Posted May 15, 2008 Ray you are a genius, thanks a million!!! Link to comment https://forums.phpfreaks.com/topic/105786-big-problem-with-quotes/#findComment-542118 Share on other sites More sharing options...
craygo Posted May 15, 2008 Share Posted May 15, 2008 NP don't forget to mark as SOLVED Ray Link to comment https://forums.phpfreaks.com/topic/105786-big-problem-with-quotes/#findComment-542137 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.