Hi
I have dropdown list of domain names.Which is populated by mysql query(1st query).
And when dropdown value is selected that value is used in another mysql query(2nd query).
I've a submit button,when it is clicked.It is working perfectly.
But i want to remove submit button and i need a jquery solution,when user select a value from dropdown list.
Form is automatically submitted. and selected value should be used in 2nd query
Here is my code.
<?php
$sql = "SELECT * FROM `domains`";
$result = mysql_query($sql);
?>
<form id="form" name="form" method="post">
<?php
$domain = $_POST['domain'];
?>
<select name='domain'>
<?php while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['id'] ."' >" . $row['name'] ."</option>";
}
?></select>
<button type ="submit" id="submit"> View Domain Details</button>
</form>
<form id="form1" name="form1" method="post">
<div class="well">
<table class="table">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>ttl</th>
<th>prio</th>
<th>Content</th>
<th style="width: 26px;"></th>
</tr>
</thead>
<tbody>
<?PHP
$sql1 = "SELECT * FROM `records` WHERE `domain_id` ='".$domain."' ORDER BY `name` ASC";
$result1 = mysql_query($sql1);
while ($myrow = mysql_fetch_array($result1)) {
?>
<tr>
<td><?PHP echo $myrow["name"]; ?></td>
<td><?PHP echo $myrow["type"]; ?></td>
<td><?PHP echo $myrow["ttl"]; ?></td>
<td><?PHP echo $myrow["prio"]; ?></td>
<td><?PHP echo $myrow["content"]; ?></td>
</tr>
<?PHP
}
?>
</tbody>
</table>
</div>