Hey,
I cant seem to work out why this if statement does not work. Basically i have populated a dropdown box via a select statement. The default field of the drop down is "Select Category"..
Now i dont want users to be able to select this category as it does not mean anything, therefore i am trying to use the following code:-
The code above keeps giving me the echo "Please select a category", but does not do the INSERT..PHP Code:if (isset($_REQUEST['added_by']))
{
$description = mysql_escape_string($description);
if($role_id == 0)
{
echo "Please select a category";
}
else
{
foreach ($_POST as $key=>$value)
{
${$key} = addslashes(trim($value));
}
$sql="INSERT INTO recruitment_jobs
(location_town_city, location_region, location_country, role_id, vacancies, contract, salary_low, salary_high, added_by, uploader_id, description, date_added)
VALUES
('$location_town_city', '$location_region', '$location_country', '$role_id', '$vacancies', '$contract', '$salary_low', '$salary_high', '$added_by', '$uploader_id', '$description', NOW());";
$mysql_insert = mysql_query($sql) or trigger_error(mysql_error() . "<p>$sql</p>", E_USER_ERROR);
$_SESSION['pigeonhole']='Addition successful';
$relocate='index.php';
$job_id=mysql_insert_id();
}
}
Can anyone please help
Regards







Bookmarks