If should use double equals for comparison.. if ($doWork == 1) { etc here}.
Of course doing multiple tests like this you are better off using switch
case...
Switch ($doWork) {
Case 0:
Exit;
Break;
Case 1:
DoOne($arguments);
Break;
Case 2:
DoTwo($arguments);
Break;
}
each number after the case statement is the value that $doWork will be
tested against.. look up Switch in the php manual, it's behavior can be a
bit weird especially if you forget to "break" if you don't break it's like
an OR statement/gate;
Carl.
-----Original Message-----
From: Daniel Szasz [mailto:[EMAIL PROTECTED]
Sent: Monday, September 15, 2003 3:29 PM
To: [EMAIL PROTECTED]
Subject: [PHP] What is wrong with this code ?
Hello
What is wrong with this code ?
$doWork = $_GET[doWork];
echo $doWork;
echo ( "<BR>");
if ( $doWork = 0) {
exit;
}
else
{
if ( $doWork = 1) {
?>
<input class=no type="button" value="Accept" onClick="doAccept();">
<input class=no type="button" value="Reject" onClick="doReject();">
<?
};
if ( $doWork = 2) {
echo ( "call request accepted");
};
if ( $doWork = "3") {
echo ( "call request rejected");
}
}
I still got in the page the 2 buttons and the 2 echo's from doWork = 2 and
doWork = 3.
Thanks
Daniel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php