php - How to check if radio is checked? -


how check if radio button checked after post?

code on radio button

<?php if(isset($_post['itemtype']) && $_post['itemtype'] == 'ingredient') echo 'checked="checked" ';?> <?php if(isset($_post['itemtype']) && $_post['itemtype'] == 'miscellaneous') echo 'checked="checked" ';?> 

code check radio:

$itemtype = $_post["itemtype"];  if($_post["itemtype"] == "ingredient") {     $try2 = "ingred. working"; ] elseif($_post["itemtype"] == "miscellaneous") {     $try2 = "misc. working"; } else {     $errormsg = "error5"; } 

if don't select radio button says "syntax error: undefined index itemtype" keeps aiming @ $itemtype = $_post["itemtype"];

and if select radio button doesn't return checked on selected radio button.

anyone can give me helping hand on thanks.

<?       $_post['itemtype'] = "ingredient";     if(isset($_post['itemtype'])) {         $itemtype = $_post["itemtype"];          if($_post["itemtype"] == "ingredient") {             $try2 = "ingred. working";          }elseif($_post["itemtype"] == "miscellaneous"){             $try2 = "misc. working";          }      } else { $errormsg = 'error5'; }     echo $try2;     echo $errormsg; ?> 

i forced itemtype debugging reasons... show logic works... question have echoing out $try2....


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -