let me explain.....1st page fill voucher detail..in 2nd page the detail will be display and if got any wrong i can edit it...once i click the edit button the new records must be changed in database and should be display in 2nd...page...but the problem is...my code make the database changed but it still display the old records...here i submit my full code
<?php
session_start();
include "db1.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=iso-8859-1" />
<title>aftersave.php</title>
<style type="text/css">
<!--
-->
h3{background-color:#CCCCCC;}
.style3 {font-size: 9px}
</style></head>
<body>
<table width="760" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="160">Prepared By </td>
<td width="220"><? if(isset($_SESSION['prepare_by'])) { echo $_SESSION['prepare_by'];} ?> </td>
<td width="160">Emp No </td>
<td width="220"><? if(isset($_SESSION['emp_1'])) { echo $_SESSION['emp_1'];} ?></td>
</tr>
<tr>
<td>E-mail Address </td>
<td><? if(isset($_SESSION['email'])) { echo $_SESSION['email'];} ?></td>
<td>Designation</td>
<td><? if(isset($_SESSION['designation'])) { echo $_SESSION['designation'];} ?></td>
</tr>
<tr>
<td>Date/Time</td>
<td><?php echo date ("m/d/Y ");echo date ("g:i a")?></td>
<td>Dept </td>
<td><? if(isset($_SESSION['department'])) { echo $_SESSION['department'];} ?></td>
</tr>
<tr>
<td>Sect Manager </td>
<td><? if(isset($_SESSION['selectmanager'])) { echo $_SESSION['selectmanager'];} ?></td>
</tr>
</table>
<h3>Voucher Details</h3>
<FORM NAME="edit" METHOD="POST" ACTION="">
<table width="400" height="120" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="160" height="54">Purpose</td>
<td width="240"><textarea name="purpose2" width="300"><? if(isset($_SESSION['purpose'])) { echo $_SESSION['purpose'];} elseif(isset($_REQUEST['edit'])){ echo $_SESSION['purpose2']; } ?>
</textarea><br /></td>
</tr>
<tr>
<td height="22">Pay to </td>
<td><input name="text" type="text" value="<? if(isset($_SESSION['pay_to'])) { echo $_SESSION['pay_to'];} ?>" /></td>
</tr>
<tr>
<td height="22">Employee No </td>
<td><input name="text" type="text" value="<? if(isset($_SESSION['emp_2'])) { echo $_SESSION['emp_2'];} ?>" /></td>
</tr>
<tr>
<td height="22">ECER</td>
<td><input name="text" type="text" value="<? if(isset($_SESSION['ecer'])) { echo $_SESSION['ecer'];} ?>" /></td>
</tr>
</table><br />
<input type="submit" name="edit" id="edit" value="EDIT" /></form>
<?php
//session_start();
if (isset($_REQUEST['edit'])){
if(@$_REQUEST['purpose2'] != $_SESSION['purpose']) {
$purpose2 =@$_REQUEST['purpose2'];
@$_SESSION['purpose2'] = @$_REQUEST['purpose2'];
}
$query = "UPDATE voucher SET purpose = '".$_REQUEST['purpose2']."' WHERE emp_1 = '".$_SESSION['emp_1']."'";
mysql_query($query) or die('Error, insert query failed');
}
?>
</body>
</html>
anyone please help...im trying to solve it for more one week...my project was suck just because of it...please help me...thanks in advanced...