0
  • I want to select a item from listbox (say listbox 1) and just after selecting
  • I want another list box (listbox 2) get data with the help of item selected in listbox 1.

List box 1 data:

<select>
  <option value="1">AXC-202</option>
  <option value="2">AXC-204</option>
  <option value="3">AXC-206</option>
  <option value="4">AXC-206</option>
</select>

Suppose if AXC-202 selected then listbox fill by query

$query = mysql_query("select from stats where sub = 1");//AXC-202

echo '<select name="Year">'; 

while ($row = mysql_fetch_array($query)) {
   echo '<option value="'.$row['year'].'">'.$row['year'].'</option>';
}

echo '</select>';

All this I wants to be done on single page.

Amarnath Balasubramanian
  • 9,300
  • 8
  • 34
  • 62
Prabhat Kashyap
  • 139
  • 2
  • 10
  • Please, [stop using `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php). They are no longer maintained and are [officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). Learn about [prepared statements](http://en.wikipedia.org/wiki/Prepared_statement) instead, and consider using [PDO](http://jayblanchard.net/demystifying_php_pdo.html). – Jay Blanchard May 06 '15 at 19:50
  • And what is your question? – steven May 06 '15 at 19:53
  • 1
    you need JS/Ajax to do this – Funk Forty Niner May 06 '15 at 19:56

0 Answers0