asad_black Posted September 10, 2009 Share Posted September 10, 2009 em facing problem in update records. form submit successfully nut records is not updating. i dont whats the problem. kindly solve my problem as soon as possible this is form page <form id="form1" name="form1" method="post" action="update_teacher_records_process.php"> <p>Name : <!-- name of this text field is "name" --> <input name="teachername" type="text" id="teachername" value="<? echo $row['teachername']; ?>"/> <br /> Email : <!-- name of this text field is "email" --> <input name="cellno" type="text" id="cellno" value="<? echo $row['cellno']; ?>"/> <br /> Tel : <!-- name of this text field is "tel" --> <input name="residentialadd" type="text" id="residentialadd" value="<? echo $row['residentialadd']; ?>"/> </p><br><br> <input name="tuition_asg" type="text" id="tuition_asg" value="<? echo $row['tuition_asg']; ?>"/> <p> <input type="submit" name="Submit" value="Submit" /> </p> </form> this is my update code <?PHP include("admin_conn.php"); // Get parameters from form. $teachid=$_POST['teachid']; $teachername=$_POST['teachername']; $cellno=$_POST['cellno']; $residentialadd=$_POST['residentialadd']; $tuition_asg=$_POST['tuition_asg']; // Do update statement. mysql_query("UPDATE teachers set teachername='$teachername', cellno='$cellno', residentialadd='$residentialadd', tuition_asg='$tuition_asg' where teachid='$teachid'"); // Re-direct this page to select.php. header("location:view_teacher_records.php"); exit; ?> datatype in database is text. Quote Link to comment https://forums.phpfreaks.com/topic/173779-problem-in-update-records/ Share on other sites More sharing options...
Maq Posted September 10, 2009 Share Posted September 10, 2009 Echo out mysql_error() to see what the problem is. You can also echo out your query to see what it actual is. Quote Link to comment https://forums.phpfreaks.com/topic/173779-problem-in-update-records/#findComment-916048 Share on other sites More sharing options...
Bricktop Posted September 10, 2009 Share Posted September 10, 2009 Hi asad_black, Your submit form is not passing a $teachid variable, so the update statement does not know which record it needs to update. Quote Link to comment https://forums.phpfreaks.com/topic/173779-problem-in-update-records/#findComment-916049 Share on other sites More sharing options...
asad_black Posted September 10, 2009 Author Share Posted September 10, 2009 thankx bricktop Quote Link to comment https://forums.phpfreaks.com/topic/173779-problem-in-update-records/#findComment-916225 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.