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.

share|improve this question
tizag.com/phpT/postget.php – BenB Mar 5 '10 at 6:39
feedback

2 Answers

Javascript :

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

share|improve this answer
he said "option value" not text of selected option. – Sarfraz Mar 5 '10 at 6:42
feedback

.......

<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'];
share|improve this answer
feedback

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.