I need your help I am using Onchange in a form to submit a dropdown data to the database, but something boring when i select the data the page get refreshed, so if i was down the page then after selecting the page takes me up again before i finish the next stage on my process. So i need the help if anyone knows how can i do to stop that, that when i will select the dropdown data the page should remain without refresh it will be well and good! I think Ajax does this but im not that much aware on AJAX
Here is my codes
<html> <form action="" method="post" style="height:1px;">
<input name="key" type="hidden" value="<?php echo $id; ?>" />
<select name="Idadi"style="width:65px;" onchange="this.form.submit();">
<option value="1" <?php if($Idadi=="1") { echo "selected"; } ?> >1</option>
<option value="2" <?php if($Idadi=="2") { echo "selected"; } ?> >2</option>
<option value="3" <?php if($Idadi=="3") { echo "selected"; } ?> >3</option>
<option value="4" <?php if($Idadi=="4") { echo "selected"; } ?> >4</option>
<option value="5" <?php if($Idadi=="5") { echo "selected"; } ?> >5</option>
</select>
</form> <?php
include('dbconnection.php');
if(isset($_POST['key'])){
$idlogin=$_POST['key'];
$idadi=$_POST['Idadi'];
$idadiquery="update `itemreg` set `Idadi` = '$idadi' where `id` ='$idlogin'";
$idadiresult = mysql_query($idadiquery);
if($idadiresult){
echo ""; // print massage
}
}
?> </html>