How to check if radio button is checked after post?
Code on my 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 to check my radio:
$Itemtype = $_POST["Itemtype"];
if($_POST["Itemtype"] == "Ingredient")
{
$try2 = "ingred. working";
]
elseif($_POST["Itemtype"] == "Miscellaneous")
{
$try2 = "misc. working";
}
else
{
$errormsg = "error5";
}
If I don't select a radio button it says "syntax error: undefined Index Itemtype" keeps aiming at the $Itemtype = $_POST["Itemtype"];
and if i select radio button it doesn't return checked on the selected radio button.
anyone can give me helping hand on this thanks.