Chodzi o dwa pliki - wybór produktu na pz, oraz dodanie go do pz ( lub wz, nie ma znaczenia)
Pytanie moje jest takie jak ograniczyæ tak± sytacje - u¿ytkownik wybiera produkt wpisuje ilosc itd - przechodzi do dodaj_do_pz.php ... produkt jest wpisywany i ok , ale co je¶li teraz da wstecz na przegladarce..
mo¿e problem tkwi w tym jak to napisalem, wklejam kod :
To jest akurat do edycji bo z tym mia³em problem
wybierz_produkt_edycja_wz.php :
if (!$db) { exit; } function ShowSel() { } } } else { } $_SESSION['nazwa'] = $dane[0]; ?> <title>Dodaj produkt</title><body bgcolor="#efefefe" text="#000000" leftmargin="0" topmargin="0" vlink="#000000" alink="#000000"> <STYLE TYPE="TEXT/CSS"><!-- A:link { color:#000000; font-family:verdana; font-style:normal; font-weight:normal; text-decoration:none; cursor:hand; } A:visited { color:#000000; font-family:verdana; font-style:normal; font-weight:normal; text-decoration:none; cursor:hand; } A:hover { color:#000000; font-family:verdana; font-style:normal; font-weight:bold; text-decoration:underline; cursor:hand; } //--></STYLE> <form action="wybierz_produkt_edycja_wz.php " method="post"> <table height="15" width="100%" border="0" cellspacing="0" cellpadding="0" bordercolor="#efefefef" bgcolor="#000000"> <tr> <td> <div align="left"><b><font size="2" color="#FF0000" face="Verdana, Arial, Helvetica, sans-serif">System obs³ugi firmy JAKAR</font></b></div> </td> <td><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="1">| ver. 1.0 | wykonanie : Leonard Pociask |</font></td> </tr> </table> <table height="10" width="10%" border="0" cellspacing="0" cellpadding="0" align="left"> <tr> <td bgcolor="#efefefe"><font size="2" color="#000000" face="Verdana, Arial, Helvetica, sans-serif"> | <a href="../index.php">G³ówna</a> </font> </td> </tr> </table> <table height="10" width="20%" border="0" cellspacing="0" cellpadding="0" align="left" bordercolor="#000000"> <tr> <td bgcolor="#efefefe"><font size="2" color="#000000" face="Verdana, Arial, Helvetica, sans-serif"> | <a href="poczatek.php">Magazyn towarów</a> </font> </td> </tr> </table> <table height="10" width="23%" border="0" cellspacing="0" cellpadding="0" align="left"> <tr> <td bgcolor="#efefefe"><font size="2" color="#000000" face="Verdana, Arial, Helvetica, sans-serif"> | Dodaj produkt</font></td> </tr> </table> <br> <table width="100%" border="1" align="center" bordercolor="#efefef" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#990000"> <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#CCCCCC">Dodaj produkt do dokumentu WZ </font></div> </td> </tr> </table> <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><font size="1"> </font></b></font></p> <table width="52%" border="1" align="center" height="181" bordercolor="#666666"> <tr> <td height="28" bgcolor="#CCCCCC" colspan="2"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><font size="1">Wybierz produkt :</font></b></font></td> </tr> <tr> <td width="38%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#000000">| Wybierz :</font> <font color="#000000"> </font></td> <td width="62%"><font color="#000000"> <select id="s" name="s" onChange="document.getElementById('hid').value='submit';this.form.submit()"> <option value="--">--</option> <?php ShowSel(); ?> </select> <input id="hid" name="hid" type="hidden" value="<?$_POST["s"]?>" /> </font></font></td> </tr> <tr> <td width="38%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">| Produkt :</font></td> <td width="62%"> </td> </tr> <tr> <td width="38%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">| Zapas: magazyn biezacy :</font></td> <td width="62%"> </td> </tr> <tr> <td width="38%"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">| Ostatnie przyjecie :</font></td> <td width="62%"> </td> </tr> </tr> <tr> <td width="38%" height="24"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">| Ilosc:</font></td> <td width="62%" height="24"> <input type="text" id="ilosc" name="t13" value="0" /> </td> </tr> <tr> <td colspan="2" height="53"> <center> <font size="2" color="#000000" face="Verdana, Arial, Helvetica, sans-serif"><a href="java script:przeladuj()" id="przeladuj">utwórz dokument</a> </font> </center> <script language="javascript"> function przeladuj(){ location = 'dodaj_produkt_wz_edycja.php?ilosc='+document.getElementById('ilosc').value; } </script> </tr> </table> </form> </body> </html>
Tutaj po wyborze produktu strona sie prze³adowywuje i wy¶wietla informacje o prod - mia³em problem z przekazaniem wybranych wartosci do dodaj_produkt_edycja_wz
Ponizej wkleje kod 2 pliku
Problem w tym ¿e poprostu sci±ga mi produkt z magazynu z zapasu - a wcale nie ma go tyle na wydaniach jak robie zestawienie :/
dodaj_produkt_wz_edycja.php
$nrwz = $_SESSION['id']; if (!$db) { exit; } $nazwa=$_SESSION['nazwa']; $ilosc=($_GET['ilosc']); $magazyn= "biezacy"; if ($magazyn == "biezacy") { $wpis= 'magazyn_biezacy_polgames'; } else { $wpis = 'magazyn_serwis'; } $aktualny_zapas= $row[0]; } if ($aktualny_zapas<$ilosc-1) { print "Zapas '".$nazwa."' jest mniejszy ni¿ proponowana ilosc do wydania - brak towaru na magazynie"; exit; } if(($ilosc) == 0 && ($ilosc) == 0.0) { echo '<font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#CCCCCC"> Nie zosta³y wype³nione obowiazkowe pola'; exit; } $result = mysql_query( "insert into wz_towar_polgames values ('".$nrwz."', '".$nazwa."', '".$ilosc."')")or die(mysql_error()); $result = mysql_query( "UPDATE $wpis SET zapas=zapas - $ilosc, ost_data='".$data."' where nazwa= '".$nazwa."' ")or die(mysql_error()); ?> <title>Produkt dodany</title><body bgcolor="#efefefe" text="#000000" leftmargin="0" topmargin="0" vlink="#000000" alink="#000000"> <STYLE TYPE="TEXT/CSS"><!-- A:link { color:#000000; font-family:verdana; font-style:normal; font-weight:normal; text-decoration:none; cursor:hand; } A:visited { color:#000000; font-family:verdana; font-style:normal; font-weight:normal; text-decoration:none; cursor:hand; } A:hover { color:#000000; font-family:verdana; font-style:normal; font-weight:bold; text-decoration:underline; cursor:hand; } //--></STYLE> <table height="15" width="100%" border="0" cellspacing="0" cellpadding="0" bordercolor="#efefefef" bgcolor="#000000"> <tr> <td> <div align="left"><b><font size="2" color="#FF0000" face="Verdana, Arial, Helvetica, sans-serif">System obs³ugi firmy JAKAR</font></b></div> </td> <td><font color="#FFFFFF" face="Verdana, Arial, Helvetica, sans-serif" size="1">| ver. 1.0 | wykonanie : Leonard Pociask |</font></td> </tr> </table> <table height="10" width="10%" border="0" cellspacing="0" cellpadding="0" align="left"> <tr> <td bgcolor="#efefefe"><font size="2" color="#000000" face="Verdana, Arial, Helvetica, sans-serif"> | <a href="../index.php">G³ówna</a> </font> </td> </tr> </table> <table height="10" width="20%" border="0" cellspacing="0" cellpadding="0" align="left" bordercolor="#000000"> <tr> <td bgcolor="#efefefe"><font size="2" color="#000000" face="Verdana, Arial, Helvetica, sans-serif"> | <a href="poczatek.php">Zestawienie faktur</a> </font> </td> </tr> </table> <table height="10" width="26%" border="0" cellspacing="0" cellpadding="0" align="left"> <tr> <td bgcolor="#efefefe"><font size="2" color="#000000" face="Verdana, Arial, Helvetica, sans-serif"> | Dodaj produkt</font> </td> </tr> </table> <br> <table width="100%" border="1" align="center" bordercolor="#efefef" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#990000"> <div align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#CCCCCC">Dodano <? $nazwa?> </font><font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#CCCCCC"> </font></div> </td> </tr> </table> <br> <table width="20%" border="1" align="center" cellspacing="0" cellpadding="0" bordercolor="#999999" height="47"> <tr> <td><font face="Verdana, Arial, Helvetica, sans-serif" size="2">-> <a href="wybierz_produkt_edycja_wz.php">dodaj kolejny produkt</a></font></td> </tr> <tr> <td><font face="Verdana, Arial, Helvetica, sans-serif" size="2">-> <a href="utworzona_wz_gotowa_podglad2.php">podglad</a></font></td> </tr> <tr> <td><font face="Verdana, Arial, Helvetica, sans-serif" size="2">-> <a href="poczatek_wz.php">zakoncz</a></font></td> </tr> </table> <p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><font size="1"> </font></b></font></p> </body> </html>