views:

44

answers:

2

How to get option value in PHP? And i want to redirect to the same page, if option is changed by using onClick() function. Anybody please help me.

+1  A: 

Javascript :

Use eleement_id.selectedIndex() function , It will give the selected option properties.

pavun_cool
he said "option value" not text of selected option.
Sarfraz
+1  A: 

.......

<select name="select" onchange="document.location.href='this-page-name.php?val=' + this.value">
  options....
</select>

You can get its value like this:

echo $_GET['val'];
Sarfraz