hello friends i wanted to use auto populate text box based on another select box using jquery ajax and wanted to pass values of both the check boxes to a php form and insert in db
my code id :
index.php
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="jquerymin.js" type="text/javascript" ></script>
<script>
function dynamic_Select(ajax_page,username)
{
$.ajax({
type: "POST",
url: ajax_page,
data: "ch=" + username,
dataType: "html",
success: function(html){
$("#demo").html(html);
}
}); }
</script>
</head>
<body>
<form method="post" action="insert.php" id="form1">
<select name="username" onchange="dynamic_Select('pages.php',this.value);" id="username" >
<option value="1">a</option>
<option value="2">b</option>
</select>
<input type="submit" />
</form>
<div id="demo">
</div>
</body>
</html>
-----------------------
[B]pages.php[/B]
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once 'connection.php';
$id=$_POST['ch'];
?>
<input type="text" value="<?php echo $id; ?>" name="abcd" id="abcd"/>
--------------------------------
[B]insert.php[/B]
<?php
echo "value is :".$_POST['abcd'];
?>
my problem is result is loaded in resultant div tag but when i try to insert into database or display value in php file it says undefined index abcd