I am new to php i want to display a text based on the item selected in combo box, how can i do so please expain
i am using the below code but nothing is happening
<html>
<body>
Department:
<p>
<select name="dep" onChange='window.location.href="tu.php?dep="+this.value;'>
<option value="" selected>--</option>
<option value="it">IT</option>
<option value="f">Finance</option>
<option value="s">Sales</option>
</select>
</p>
</body>
</html>
<?php
$dep=@$_GET["dep"];
switch($dep)
{
case 'it':
echo "Software Developer, Graphic Designer, Web Designer, Technical Support";
alert("test");
break;
case 'f':
echo "Cost Analyst, Chartered Accountant, Company Secretary Accountant, Auditor";
break;
case 's':
echo "Sales Executive, Sales Manager, Sales Analyst";
break;
default:
echo "";
}
?>
how can I read combobox selected value
Moderators: egami, macek, gesf
-
- New php-forum User
- Posts: 64
- Joined: Thu Mar 14, 2013 6:10 am
johnj thanks for the prompt reply.
is there any book of website or sample which i can refer to to understand php controls specially combobox
is there any book of website or sample which i can refer to to understand php controls specially combobox
Here is one: http://api.jquery.com/change/
-
- php-forum Fan User
- Posts: 973
- Joined: Mon Oct 01, 2012 12:32 pm
w3schools.com is a great resource also, and it's actually html controls rather than php