ajaxl Posted January 5, 2008 Share Posted January 5, 2008 Hi I am a total nube with ajax (in fact just broke the ice with it today) I have created a link to mysql database and can view these records as well. I am trying to create a form that will edit the details that are displayed as well. This will update when i hit the Update button but only the first line is this a common problem. Any help would be great. Here is the html and function from my ajax app i can post more if it is useful. HTML/PHP while($row = mysql_fetch_array($result)) { echo "<form name='meals".$row['ID']."'>"; echo "<input type='text' id='itemID' value='".$row['ID']."'/> "; echo "<input type='text' id='mealName' value='". $row['mealName'] ."' /><input type='button' onClick='updateRequest();' value='Update' /> <a href='javascript:deleteRequest('".$row['ID']."');'>Delete</a>"; echo "<br/>"; echo "</form>"; } mysql_close($con); XML/JAVASCRIPT. function updateRequest() { var url="update.php"; //xmlHttp.open('get', 'update.php?' + mealName + '&ID=' + ID); var mealName = document.getElementById('mealName').value; var ID = document.getElementById('itemID').value; url=url+"?mealName="+mealName; url=url+"&ID="+ID; xmlHttp.open("GET",url,true); xmlHttp.onreadystatechange = handleResponse; xmlHttp.send(null); } thanks Quote Link to comment Share on other sites More sharing options...
priti Posted January 7, 2008 Share Posted January 7, 2008 Hi, You are creating multiple forms??? I think to update any row your don't need a form .My advice would be create your <from> tab above the while loop and inside the loop try to make the form fields.It will ease your task. Let me know if you feel some problem after this. regards Quote Link to comment 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.