suri1980 Posted March 27, 2007 Share Posted March 27, 2007 Hi i need help on the following, check my code below. access.html <script language="javascript"> var XHRObj = false; if (window.XMLHttpRequest) { XHRObj = new XMLHttpRequest(); }else if (window.ActiveXObject){ XHRObj = new ActiveXObject("Microsoft.XMLHTTP"); } function getit(divid){ if (XHRObj) { var obj = document.getElementById(divid); XHRObj.open("GET", "access.php?option=1"); XHRObj.onreadystatechange = function (){ if (XHRObj.readystate == 4 && XHRObj.status==200) { obj.innerHTML = XHRObj.responseText; } } XHRObj.send(null); } } </script> <form name="sample"> <INPUT TYPE="button" name="but" value="Click Me!" onclick="getit('DisplayHere');"> </form> <div id="DisplayHere">The Fetched data will be here</div> access.php <? $conn = mysql_connect('localhost', 'root', '') or die(mysql_error()); $seldb = mysql_select_db('test'); ?> <FORM NAME="SAMPLE" METHOD="POST"> <INPUT TYPE="text" NAME="name"> <INPUT TYPE="button" value="Submit"> </form> DB sample - > {id(int),name(varchar)} From the access.html on clicking the Click Me Button, i am loading another form using access.php at DisplayHere Div. In newly loaded form when i enter name and click submit button it should update the database. I tried all the possibilities to update the DB table but failed . Is it possible update at the same location (DisplayHere Div) with the message, Name submitted (it should be in access.html with ajax loaded form and with the updated message)? 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.