Code: Select all
//check for category of organization
if (($_POST['category1'] > 0) OR ($_POST['category2'] > 0) OR ($_POST['category3']) >0)
{
$c = true;
}
else
{
$c = false;
$message .= 'Please select at least 1 category<br>';
}Moderator: General Moderators
Code: Select all
//check for category of organization
if (($_POST['category1'] > 0) OR ($_POST['category2'] > 0) OR ($_POST['category3']) >0)
{
$c = true;
}
else
{
$c = false;
$message .= 'Please select at least 1 category<br>';
}Code: Select all
<select name="e;category"e;>
<option value="e;category1"e;>cat1</option>
<option value="e;category2"e;>cat2</option>
<option value="e;category3"e;>cat3</option>
</select>Code: Select all
// set $c to FALSE generally or manually inside the if
$c=FALSE;
// allowed user input
$allowed_categories = ARRAY('category1', 'category2', 'category3');
if (!isset($_POST['category']))
{
//$c=FALSE;
$message .= 'Please select at least 1 category<br>';
}
else
{
// always check user input
if (!in_array($allowed_categories))
{
//$c=FALSE;
$message .= 'possible hack<br>';
}
else
{
$c=TRUE;
$chosen = $_POST['category'];
}
}