Page 1 of 1

Help For Insert and Update Data

Posted: Thu Mar 01, 2012 7:41 pm
by davidalwis
Dear Developers,

Need your help regarding the case below :
1. First the data show after user input submission in.
2. After data show, there are combobox with status : "acknowledge" and "reject".
3. After submitted, must be acknowledge by each submission.
4. My code just submit 1 submission although there are many submission.

My Desire :
1. Can submit all submission who showed.
2. After submit, data in page will now show again because have submitted.
<?php
include ("config.php");

$date = date("d-M-Y");
$status = "na";

$query = "SELECT COUNT(*) FROM t_submission_accounting WHERE otdate='$date'";
mysql_select_db("sei");
$hasil = mysql_query ($query);

$jml_rec = mysql_result($hasil, 0);

echo "<input type='hidden' name='jml_rec' value='$jml_rec'>";

$n = $jml_rec;

$rs = mysql_query("SELECT * FROM t_submission_accounting WHERE otdate='$date' AND status='$status' ORDER BY time_submission DESC");

?>
<?php
session_start();
include ("config.php");

if(!isset($_SESSION['username']))
{
header('Location: index.html');
}

if($_SESSION['level']!="supervisor")
{
die("Sorry, You don't have authorized to access this page.");
}

$n = $_POST['jml_rec'];
for ($i=1; $i<=$n; $i++)
{
$status = $_POST['status'];
$acknowledge_date = date("d-M-Y");
$acknowledge_by = $_SESSION['username'];
$form_no = $_POST['form_no'];

$query = "INSERT INTO t_acknowledge_accounting(status,acknowledge_date,acknowledge_by,form_no)
VALUES('$status', '$acknowledge_date', '$acknowledge_by', '$form_no')";

mysql_query($query);
}

require ("supervisor.php");
?>
Thanks for your kind support.
David