Data Retrieve from HTML Select Box and Print into PHP

Simple but tricky. without ajax or Jquery or JavaScript, you can simply get onchange html select box data into your php and can do great things easily.

Step-1: make a html form into a php page.


<form method="POST">
	<select name="selectBox" id="selectBox" onchange="this.form.submit()">
		<option value="">Select Country</option>
		<option value="bangladesh">Bangladesh</option>
		<option value="australia">Australia</option>
		<option value="usa">USA</option>

Steo-2: Write PHP code in the same page.

if(isset($_POST)) {
	print "<br/>".$country;


Download Full source Code.

Happy Coding



We will be happy to hear your thoughts

Leave a reply

Register New Account
Reset Password