Witam,
mam taki kod:
<?php
require ('sess.php');
include ('start.html');
include ('connect.php');
include ('query.php');
// echo "Dane: ";
// print_r($_POST);
// $count=count($_POST[data]);
// echo "Licznik:".$count;
// for($i=0;$i<$count;$i++){
// if($_POST[data][$i]<>''){
// echo "<br>Wartość :".$_POST[data][$i];
// }
// }
$w=0;
$temp=0;
$result111 = mssql_query($query15);
while($p = mssql_fetch_assoc($result111)) {
$ida = $p['ID'];
if($ida == $_POST[data][$w]){
$w++;
if($temp<>0){
if($temp<>$p['NR_DET']){
echo "You can select only items for one part number to be shiped together!"; echo '<br><INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;">'; include ('footer.html');
}
}
$temp=$p['NR_DET'];
}
}
$result15 = mssql_query($query15);
echo "<strong>".$_SESSION['nazwa1']." - ".$_SESSION['comname']."</strong>"; $t=0;
echo "<table cellpadding=\"2\" border=1>"; echo "<caption align='ustawienie'><font color='red'></caption>"; echo "<form name='form1' method='post' action=''>";
echo "<th><strong>ID</strong></th>"; echo "<th><strong>Part number</strong></th>"; echo "<th><strong>Delivery Qty</strong></th>"; echo "<th><strong>Packing slip</strong></th>"; echo "<th><strong>Boxes</strong></th>"; echo "<th><strong>Box weight</strong></th>"; echo "<th><strong>PO number</strong></th>"; echo "<th><strong>PO Line</strong></th>"; while($r = mssql_fetch_assoc($result15)) {
$id = $r['ID'];
if($id == $_POST[data][$t]){
$t++;
include('kolor.php');
echo "<tr><td>".$r['ID']."</td>"; echo "<td>".$r['NR_DET']."</td>"; echo "<td>".$r['ILOSC']."</td>"; echo "<td><input type=text name=pack_slip value='".$r['PACKING_SLIP']."'/></td>"; echo "<td><input type=text name=boxes value='".$r['BOXES']."'/></td>"; echo "<td><input type=text name=box_weight value='".$r['BOX_WEIGHT']."'/></td>"; echo "<td>".$r['NR_ZAMOWIENIA']."</td>"; echo "<td>".$r['NR_LINII']."</td>"; echo "<td><input type='submit' name='Save' value='Save'></td></tr>"; $gti=$r['ID'];
$pack_slip=$_POST['pack_slip'];
$boxes=$_POST['boxes'];
$box_weight=$_POST['box_weight'];
if($pack_slip!=$r['PACKING_SLIP'] or $boxes!=$r['BOXES'] or $box_weight!=$r['BOX_WEIGHT']){
$query22="UPDATE [PORTAL].[dbo].[IT_TEST] SET packing_slip = '$pack_slip' ,boxes = '$boxes', box_weight = '$box_weight' WHERE ID = '$gti'";
$result22=mssql_query($query22);
}
}
$ps++;
}
mssql_close($dbhandle);
include ('footer.html');
?>
Do tego pliku przekazuję zmienne w tablicy data metodą POST.
Jednak gdy zrobię refresh (F5) to wszystko znika - zmienne się kasują. Jak zapisać je na stałe, aby się nie kasowały?
Jest jeszcze kwestia tego, że nie działa zapisywanie wartości do SQL poprzez Update - nie wiem co tam jest nie tak.
Jeśli macie jakieś pomysły to pomoc mile widziana.