Jump to content

Big problem with quotes...


Geo877

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.