I'm not even sure how to classify this...

Given:

<INPUT NAME="action" TYPE="SUBMIT" VALUE='<?=$Enabled?>');">

Where $Enabled is either a 0 or 1 as read from a database ( TINYINT(1)
);

And

echo "action = ".$_POST[action]."<BR>";
if ($_POST[action] == "1" || $_POST[action] == "0")
  echo = "UPDATE Company SET Enabled = ".!(intval($_POST[action]))."
WHERE CompanyID = $id";

(skipping all the obvious bits -- no pun intended)

I cannot figure out how to simply make the 0 and 1 invert or negate or
toggle as it were.

When I submit the form, my output is:

action = 0
UPDATE Company SET Enabled = 1 WHERE CompanyID = 89

action = 1
UPDATE Company SET Enabled = WHERE CompanyID = 17

I've tried all kinds of combinations, but whenever the action is 1 to
begin with, the 'inverted' version is always blank or -2 when I would
expect it to be 0.

If I use 
  echo = "UPDATE Company SET Enabled = ".~(intval($_POST[action]))."
WHERE CompanyID = $id";

action = 1
UPDATE Company SET Enabled = -2 WHERE CompanyID = 17


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

Reply via email to