• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

wats the deal with \"blah\" and \'blah\' ??

tru to change this line :
PHP:
<input type=hidden name="usr_joke" value="<?php echo $usr_joke;?>">
into this :
PHP:
<input type=hidden name="usr_joke" value="<?php echo stripslashes($usr_joke);?>">
 
Originally posted by megapuzik

the problem is when you write " you get \" right ??

yeah, and in the preview it shows as

joke here \"quote\"

but when u view if from the database it looks like this

joke here \
 
Originally posted by ozefrog


yeah, and in the preview it shows as

joke here \"quote\"

but when u view if from the database it looks like this

joke here \
well, you can always try use srt_replace ->
PHP:
<?php $usr_joke = str_replace('\"','"',$usr_joke);?>
<input type=hidden name="usr_id" value="<?php echo $usr_id;?>"> 
<input type=hidden name="usr_joke" value="<?php echo $usr_joke;?>"> 
<input type=hidden name="usr_ans" value="<?php echo $usr_ans;?>">
Not sure that this will work cuz you maybe needed to change the signs to the ascii ! (< = &lt ..............)
 
Originally posted by megapuzik

well, you can always try use srt_replace ->
PHP:
<?php $usr_joke = str_replace('\"','"',$usr_joke);?>
<input type=hidden name="usr_id" value="<?php echo $usr_id;?>"> 
<input type=hidden name="usr_joke" value="<?php echo $usr_joke;?>"> 
<input type=hidden name="usr_ans" value="<?php echo $usr_ans;?>">
Not sure that this will work cuz you maybe needed to change the signs to the ascii ! (< = &lt ..............)
bah, this board convert ascii, < will be & l t [without the spaces]
 
Originally posted by ozefrog
yes cos i run a joke site, and a lot of jokes have quotes and stuff in it
ok, let me understand, when someone sumbit a joke, in the preview there is no problems with the ", but after the preview, the problems appear again.
then you should use the str_replace in the script that sumbit your joke ! (not only to the preview.

Im going to sleep now, talk with later :)
 
<?php


include("joke4cfg.php");
$date_post = date("Y-m-d H:i:s");
$connection = mysql_connect($serverAddress,$databaseName,$serverPass)or die("Couldn't make connection.");
$db = mysql_select_db($databaseName,$connection)or die("Couldn't select database");
$insertSql ="insert into joke4 values ('".$usr_name."','".$usr_id."','".$usr_joke."','".$usr_ans."','".$date_post."')";
mysql_query($insertSql);
mysql_close($connection);
include '/usr/home/o/z/ozefrog/public_html/lib/header.inc';
echo "\n\n<font face=verdana size=2><center><strong>Your joke has been added into the joke archive!</center></strong></font><br><br>";
echo "<br><br><br><br><font size=2><center>Click <a href=joke4.php>Here</a> to go back to the joke archive.</font></center>";
include '/usr/home/o/z/ozefrog/public_html/lib/footer.inc';
?>

that was the add code
 
Remove the str_replace and in this code, put this in the top :
PHP:
$usr_joke = stripslashes(htmlspecialchars($usr_joke)) ;

and also, put this code at the top of the page where you preview your joke, it shold work !!
 
Originally posted by ozefrog
works in perview but it wont add the joke now
so remove this when you add to the database, and add this line in the top of the page that show the joke.
 
Back
Top