Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Ajax Programming

How to update the DataBase Table using the form loaded by Ajax


Hi i need help on the following, check my code below.

<b>access.html</b>

<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>

<b>access.php</b>

<?
   $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>

<b>DB</b>

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)?

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc