php - Updating from Null to something and vice versa through IF/ELSEIF/ELSE? -


i making php script use if/elseif/else statement. have table column null(empty) field , trying store column when user decides not click submit button , clear column field when user submits. $field storing specific column.

if($field == null) {     $sql = mysqli_query("update table set = 'something' id='1'");         if(isset($_post["x"])) {              $sql = mysqli_query("update table set = null id='1'");         } else {             echo "null1 error";         } } elseif (!empty($field)) {     if(isset($_post["x"])) {          $sql = mysqli_query($db_conx, "update table set = null id='1'");     } else {         echo "null2 error";     }     } else {     echo 'error'; } 

the problem while want @ end $_post happens elseif statement , if don't refresh page(to test) , hit submit button $_post comes if statement. doing wrong here? ps: more specific on doing user gets form/details needs submit. don't want him bypass without submission storing database until submits info. if refresh page or visit page after month same form until submit info.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -