Re: Re: comparing strings - again!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Soted it was an extra whitespace character being added to the posted answer. The var_dump function highlighted it! nice Work Jochem. No idea where it campe from though!

R.
----- Original Message ----- From: "Jochem Maas" <jochem@xxxxxxxxxxxxx>
To: "Ross" <ross@xxxxxxxxxxxxx>
Cc: <php-general@xxxxxxxxxxxxx>
Sent: Tuesday, June 20, 2006 3:57 PM
Subject: Re:  Re: comparing strings - again!


Ross wrote:
This does not work although when I echo out the strings they are exactly the
same. Strange!

try using var_dump($compare1, $compare2);



"Ross" <ross@xxxxxxxxxxxxx> wrote in message news:...
if (isset($_POST['Submit'])) {
//echo "post equals".$_POST['x']."     corect
is".$correct_answers[$page-1];
$compare1 = $_POST['x'];
echo "page is".$page;
$compare2 = $correct_answers[($page-1)];
echo "compare1 is ".$compare1;
echo "<BR>";
echo "compare2 is ".$compare2;

if (strcmp($compare1, $compare2) == 0) {
$incrementedPage = $page + 1;
?>
<script type="text/javascript">
<!--
window.location = "http://www.google.com/";
//-->
</script>
<?
//header("Location: evaluation.php?page=$incrementedPage");
}

else {
$chances++;
echo "you have had".$chances;
}

}


?>






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux