How to handle dropdown list in php?

tresseslover

New member
Please tell me how to handle this code for the drop down list.... i want to use the drop down list to print something or to choose the opetion that will direct me to the option...

Please help

I have this code below ... it checks the drop down list with the CHECK button and then prints whatever option is selected... i hope its the correct code.
This code doesnt accept anything and does not print anything.. please tell me whats wrong with this code and how can I modify to make this thing work...

<?php

$employer = $_POST['employerOpt'];
$jobseeker = $_POST['jobSeekerOpt'];
$check = $_POST['check'];




if($check)
{

if($employer)
{
echo "<h3>EMPLOYER SELECTED</h3>";
}
else if($jobseeker)
{
echo "<h3>JOB SEEKER SELECTED</h3>";
}

}

?>



<head>

<title></title>
</head>

<body>

<h2>We are cheking the drop down menu</h2>

<form action = "test.php" method = "POST">

<select name="selectReg" id="selectReg">
<option selected>Choose One</option>
<option value="employerOpt"> Employer</option>
<option value="jobSeekerOpt">Job Seeker</option>
</select>
<input type = "submit" value = "Check" name = "check">

</form>
</body>
</html>
 
Back
Top