form quotes problem<

liunx

Guest
i've got a fill in the blank type quiz and some of the answers use apstrophes - only they wont pass over and be validated


<?phpif ($_POST['q1'] == 'l'objectif'){echo ('correct');} else {echo ('<b>l'objectif</b>');} ?>

this doesn't work either

<?phpif ($_POST["q1"] == "l'objectif"){echo ("correct");} else {echo ("<b>l'objectif</b>");} ?>

nor does escaping the \'
problem seems to be that php is looking for an exact string match and is also magicing the damned quote (but I really don't want to turn magic quotes off)

any suggestions?<?
if ($_POST['q1'] == "l'objectif")
{
echo "correct";
}
else
{
echo "<b>l'objectif</b>";
}

?>


You must be careful using single quotes and double quotes.

for IF and ELSEIF statements, the condition should be in double quotes.

You can also use double quotes to enclose ECHO data instead of parentheses.

Along with that, I practice using single quotes inside bracketed values:

$_POST['value']b*gger - now it's working, but it is escaping the answer so that it wont validate!

6. L'ind闁渆ndance du Qu闁巈c est l\'objectif du parti politique Parti Qu闁庨枏ois (PQ).

not correct...

ok ... how do i stop it escaping in the form?use stripslashes() on it
 
Back
Top