i want to update value(s) as a student change value(s) in correction or update form.
till know i'm able to fetch and display values in text boxes on the bases of name selected from dropdown list from data base using ajax and json. but when i try to update database it do not works...
HTML:
<select name="u_stu" id="u_stu" onchange="show(this.value);" style="float:right; height:30px; width:180px;">
<option selected="selected" disabled="disabled">Choose</option>
<option>stu1</option>
<option>stu2</option>
<option>stu3</option>
</select>
name: <input type="text" id="name" name="name" style="float:right; height:20px; width:200px;"/><br /><br />
age: <input type="text" id="age" name="age" style="float:right; height:20px; width:200px;" /><br /><br />
phone: <input type="text" id="phone" name="u_ver_txt" style="float:right; height:20px; width:200px;" /><br /><br />
address: <input type="text" id="add" name="add" style="float:right; height:20px; width:200px;" /><br /><br />
hobby: <input type="text" id="hobby" name="hobby" style="float:right; height:20px; width:200px;" /><br /><br />
<input type="submit" value="Submit" name="u_s2" id="u_s2" style="position:relative; top:-180px; "/>
MYSQL PHP
<?php
$c=mysql_connect("localhost","abc","xyz");
mysql_select_db("root");
if(isset($_POST['u_s2']))
{
$name=$_POST["name"];
$age=$_POST["age"];
$phone=$_POST["phone"];
$address=$_POST["address"];
$hobby=$_POST["hoddy"];
$id=$_POST["u_id"];
$q2="UPDATE student SET
name=$name,age=$age,phone=$phone,address=$address,hobby=$hobby WHERE Sr. no=$id";
mysql_query($q2);
}
?>
or die(mysql_error())and turn on error reporting to give you a better idea of what's going on. This doesn't look validWHERE Sr. no=$id