title: PHP: check if posted variable exists or assign null value
body: <p>This can be done in Javascript with isNAN instead of !isset.
  Using the example below - both forms post to my script, one without a value and one with a value. Is the below code a correct way to do this in PHP to assign a value if the post var is not present?</p>
  
  <p><strong>$mycheck = !isset($_POST['value']) ? 0 : $_POST['value'];</strong></p>
  
  <pre><code>&lt;? 
  if($_POST) :
    $mycheck = !isset($_POST['value']) ? 0 : $_POST['value'];
    echo $mycheck;
  endif;
  ?&gt;
  
  &lt;!-- send value--&gt;
  &lt;form action="" method="post"&gt;
    &lt;select name="value"&gt;
      &lt;option value="0"&gt;0&lt;/option&gt;
      &lt;option value="5"&gt;5&lt;/option&gt;
    &lt;/select&gt;
    &lt;input type="submit" name="submit"&gt;
  &lt;/form&gt;
  
  &lt;!-- doesn't send value--&gt;
  &lt;form action="" method="post"&gt;
    &lt;input name="different_var"&gt;
    &lt;input type="submit" name="submit"&gt;
  &lt;/form&gt;
  </code></pre>