hi i am facing problem i need a confirm box in inserting or updating data
my code is as follows
FIRST PAGE
<?php
session_start();
?>
<!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>Section Form</title>
<script type="text/javascript">
var http = false;
if(navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
http = new XMLHttpRequest();
}
function replace(a) {
http.open("GET", "test.php?n="+a, true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
document.getElementById('foo').innerHTML = http.responseText;
}
}
http.send(null);
}
</script>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
include("../../erpschool/db/csschooldb.php");
$uid='cstest';
$query="SELECT classid,branchncode from class where userid='".$uid."'";
$Result1=mysql_query($query);
while($ressections=mysql_fetch_array($Result1, MYSQL_BOTH))
{
$classids=$ressections['0'];
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><form action="branchs.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<table width="400" border="0" cellspacing="2" cellpadding="2">
<tr>
<td align="center"><div id="wrapsmall">
<table width="100%" border="0" cellspacing="2" cellpadding="2" bgcolor="#f7f7f7">
<tr>
<td class="idright">Branch Code</td>
<td><select name="brncd" class="caldrop" id="clsstudied" >
<?php
$Result = mysql_query('SELECT classid,branchncode FROM class where userid="'.$uid.'"');
echo $Result;
while($sections = mysql_fetch_assoc($Result)){
echo "<option "; if ($sections['classid']){ echo "selected='selected'"; } echo "value=". $sections['classid'].">".$sections['branchncode']."</option>\n";
}
?>
</select></td>
<td class="idright"> </td>
<td> </td>
<td class="idright"> </td>
<td> </td>
</tr>
<tr>
<td class="idright">Class</td>
<td><select name="cls" class="caldrop" id="admsogt" >
<?php
$Result = mysql_query('SELECT userid,classid,classtype,branchncode FROM class');
while($sections = mysql_fetch_assoc($Result)){
echo "<option "; if ($sections['classid']){ echo "selected='selected'"; } echo "value=". $sections['classid'].">".$sections['classtype']."</option>\n";
}
?>
</select></td>
<td class="idright"> </td>
<td> </td>
<td class="idright"> </td>
<td> </td>
</tr>
<tr>
<td class="idright">How many Section</td>
<td><span class="idright">
<select name="se" class="textfield" id="textfield3" onchange="javascript:replace(this.value)"/>
<option value="">sel</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
<option value="11">11</option>
<option value="12">12</option>
<option value="13">13</option>
<option value="14">14</option>
<option value="15">15</option>
<option value="16">16</option>
<option value="17">17</option>
<option value="18">18</option>
<option value="19">19</option>
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
<option value="23">23</option>
<option value="24">24</option>
<option value="25">25</option>
<option value="26">26</option>
<option value="27">27</option>
<option value="28">28</option>
<option value="29">29</option>
<option value="30">30</option>
</select>
</span></td>
<td class="idright"> </td>
<td> </td>
<td class="idright"> </td>
<td> </td>
</tr>
<tr>
<td colspan="2">
<div id="foo"></div>
</td>
</tr>
<tr>
<td colspan="6" class="idright"><table width="98%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td align="left"> </td>
<td align="right"><input name="submit" type="submit" id="button2" value="Submit" /></td>
</tr>
</table></td>
</tr>
</table>
</div></td>
</tr>
</table>
</form> </td>
</tr>
<tr>
<td align="center"> </td>
</tr>
</table>
</body>
</html>
SECOND PAGE
<?php
session_start();
include("../../erpschool/db/csschooldb.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>Document</title>
<script language="javascript">
function checkAll(){
for (var i=0;i<document.forms[0].elements.length;i++)
{
var e=document.forms[0].elements[i];
if ((e.name != 'allbox') && (e.type=='checkbox'))
{
e.checked=document.forms[0].allbox.checked;
}
}
}
var http = false;
if(navigator.appName == "Microsoft Internet Explorer") {
http = new ActiveXObject("Microsoft.XMLHTTP");
} else {
http = new XMLHttpRequest();
}
function reeplace(a) {
http.open("GET", "teest.php?n="+a, true);
http.onreadystatechange=function() {
if(http.readyState == 4) {
document.getElementById('foo').innerHTML = http.responseText;
}
}
http.send(null);
}
</script>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
$a=$_SESSION['name'];
$a="cstest";
$sx="SELECT * FROM msection";
$rx=mysql_query($sx);
$branchquery='SELECT srno,branchcode,branchname FROM branches where userid="'.$a.'"';
$Resultbranchquery = mysql_query($branchquery);
if(isset($_GET['method']))
{
$branchcode=$_POST['brncd'];
echo $branchcode;
$bqry='SELECT userid,classid,classtype,branchncode FROM class where userid="'.$a."'";
echo $bqry;
$ResultClass = mysql_query('$bqry');
}
?>
<table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#f7f7f7">
<tr>
<td colspan="4" class="idb"> </td>
</tr>
<tr>
<td class="idright">Branch</td>
<td><select name="brncd" class="caldrop" id="clsstudied" onchange="javascript:reeplace(this.value)" >
<?php
while($sectionsResult = mysql_fetch_assoc($Resultbranchquery)){
echo "<option "; if ($sectionsResult['branchcode']){ echo "selected='selected'"; } echo "value=". $sectionsResult['branchcode'].">".$sectionsResult['branchname']."</option>\n";
}
?>
</select></td>
<td></td>
<td> </td>
</tr>
<tr>
<td class="idright">Class</td>
<td><select name="cls" class="caldrop" id="admsogt" >
<?php
while($sections = mysql_fetch_assoc($ResultClass)){
echo "<option "; if ($sections['classid']){ echo "selected='selected'"; } echo "value=". $sections['classid'].">".$sections['classtype']."</option>\n";
}
?>
</select></td>
<td></td>
<td> </td>
</tr>
<tr>
<td class="idright">user id:<?php echo $a; //echo $_SESSION['name'] ?></td>
<td></td>
<td></td>
<td> </td>
</tr>
</table>
<div id="foo"><div>
</body>
</html>