Hi
i am working with three different file
- index.php
- editvalue.php
- code_editvalue.php
INDEX.php codes
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
// Get the HTTP Object
function getHTTPObject(){
if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
else if (window.XMLHttpRequest) return new XMLHttpRequest();
else {
alert("Your browser does not support AJAX.");
return null;
}
}
// Change the value of the outputText field
function setOutput(){
if(httpObject.readyState == 4){
document.getElementById('information').innerHTML = httpObject.responseText;
}
}
// Implement business logic
function doWork()
{
httpObject = getHTTPObject();
if (httpObject != null) {
httpObject.open("GET", "forms/editvalue.php", true);
httpObject.send(null);
httpObject.onreadystatechange = setOutput;
}
}
</script>
</head>
<body>
<a href="javascript:void(0)" onclick="doWork();">Call Function</a>
</body>
</html>
- index.php file contains a link Call function and a div with id "information", when we click on link editvalue.php is loaded in information div successfully. I am using javascript and ajax to load editvalue.php inside
Now editvalue.php contains text box and button i.e. Submit
I want to store value to database by clicking on Submit button.
editvalue.php codes
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Edit Value</title>
</head>
<body>
<form action="code_editvalue.php" method="post">
<input type="text" name="txt_name" value="Text box value is here"/>
<button type="button" style="width:130px;"></button>
</form>
</body>
</html>
and code_editvalue.php contains the code to insert in to database. The code for insertion is correct but still not able to insert in database please tell any solution.
Thanks in advance.