Mamy sobie kod jak nizej, w nim dwa form. jeden bedzie do wyciagania danych, drugi do dodawania. Narazie zajmuje sie tym drugim, ale nie wiedziec czemu nie dziala mi zbytnio wysylanie, nie wyswietla zadnego bledu. Dziala pobieranie danych z bazy. Linie 161 - 181
Druga sprawa, mam pole select, i chcial bym, aby po kliknieciu na jakas pozycje, przechodzilo na dana strone, dokladniej form2.php?technik=Technik 1&, linie 44-49
<? require "connection.php"; connection(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="pl" xml:lang="pl"> <head> <title>Eldom Bis</title> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="style2.css" /> <link rel="stylesheet" type="text/css" href="calendar.css" /> <link rel="stylesheet" href="jquery.ui.all.css"> <script src="js/jquery-1.4.4.js"></script> <script src="js/jquery.ui.core.js"></script> <script src="js/jquery.ui.widget.js"></script> <script src="js/jquery.ui.datepicker.js"></script> <script type="text/javascript" src="view.js"></script> <script type="text/javascript" src="calendar.js"></script> <script> $(function() { $( "#datepicker" ).datepicker(); }); </script> </head> <body> <div id="box"> <div id="logo"> <div class="demo"> <p>Date: <input type="text" id="datepicker"></p> </div> </div> <br /> <div id="form"> <form action="form2.php" method="post"> <ul> <li> <label class="opis">Technik: </label> <select class="element select medium" id="element_1" name="element_1"> <option value="1" ></option> <option value="2" ><a href="www.wp.pl">Technik 1</a></option> <a href="www.wp.pl"><option value="3" >Technik 2</option></a> <option value="4" >Technim3</option> </select> </li><li> <label class="opis">Od: </label> <span> <input size="2" maxlength="2" value="" type="text"> / <label >MM</label> </span> <span> <input size="2" maxlength="2" value="" type="text"> / <label >DD</label> </span> <span> <input size="4" maxlength="4" value="" type="text"> <label >YYYY</label> </span> <span> <img id="cal_img_2" class="datepicker" src="calendar.gif" alt="Pick a date."> </span> <script type="text/javascript"> Calendar.setup({ inputField : "element_2_3", baseField : "element_2", displayArea : "calendar_2", button : "cal_img_2", ifFormat : "%B %e, %Y", onSelect : selectDate }); </script> </li><li> <label class="opis">Od: </label> <span> <input size="2" maxlength="2" value="" type="text"> / <label >MM</label> </span> <span> <input size="2" maxlength="2" value="" type="text"> / <label >DD</label> </span> <span> <input size="4" maxlength="4" value="" type="text"> <label >YYYY</label> </span> <span> <img id="cal_img_2" class="datepicker" src="calendar.gif" alt="Pick a date."> </span> <script type="text/javascript"> Calendar.setup({ inputField : "element_2_3", baseField : "element_2", displayArea : "calendar_2", button : "cal_img_2", ifFormat : "%B %e, %Y", onSelect : selectDate }); </script> </li> </ul> <br /><br /> <ul><li> <button type="submit">Szukaj</button> </li><li> <button type="reset">Wyczyść</button> </li></ul> </form> <br /><br /><br /> <hr /> <form action="form2.php" method="post"> <ul> <li> <label class="opis">Numer: </label> <input name="numer" type="text" maxlength="255" value=""/> </li><li> <label class="opis">Data: </label> </li><li> <label class="opis">Typ: </label> <select name="typ"> <option value="1" >Gwarancja</option> <option value="2" >Odpłatne</option> <option value="3" >Inne</option> </select> </li><li> <label class="opis">Robocizna: </label> <input name="robocizna" type="text" size="5" maxlength="5" value=""/> </li><li> <label class="opis">Materiał: </label> <input name="material" type="text" size="5" maxlength="5" value=""/> </li><li> <label class="opis">Dojazd: </label> <input name="dojazd" type="text" size="5" maxlength="5" value=""/> </li><li> <label class="opis">Inne: </label> <input name="inne" type="text" size="5" maxlength="5" value=""/> </li><li> <label class="opis">Procent: </label> <input name="procent" type="text" size="5" maxlength="5" value=""/> </li><li> <label class="opis">Opis: </label> <input name="opis" type="text" size="25" maxlength="255" value=""/> </li></ul> <br /><br /> <ul><li> <input type="submit" value="Wyślij"/> </li><li> <button type="reset">Wyczyść</button> </li></ul> </form> <? /*$technik = $_POST['technik']; */ $numer = $_POST['numer']; $data = $_POST['data']; $typ = $_POST['typ']; $robocizna = $_POST['robocizna']; $material = $_POST['matrial']; $dojazd = $_POST['dojazd']; $inne = $_POST['inne']; $procent = $_POST['procent']; $opis = $_POST['opis']; if($numer and $data and $typ and $robocizna and $material and $dojazd and $inne and $procent and $opis) { $ins = @mysql_query("INSERT INTO test SET numer='$numer', data='$data', typ='$typ', robocizna='$robocizna', material='$material', dojazd='$dojazd', inne='$inne', procent='$procent', opis='$opis'"); } ?> <br /><br /><br /><br /> <hr /> <table> <tr class="glowne"> <td>Numer:</td> <td>Data:</td> <td>Typ:</td> <td>Robocizna:</td> <td>Materiał:</td> <td>Dojazd:</td> <td>Inne:</td> <td>Procent:</td> <td>Opis:</td> </tr> <?php $counter++; if ( ($r['numer'] && $r['data'] && $r['typ']) == null) { $list="list3"; } else { if ( $counter % 2 == 0) { $list = "list1"; } else { $list = "list2"; } } } } ?> </div> </div> </body> </html>
-- -- Struktura tabeli dla `test` -- CREATE TABLE IF NOT EXISTS `test` ( `numer` text NOT NULL, `data` text NOT NULL, `typ` text NOT NULL, `robocizna` text NOT NULL, `material` text NOT NULL, `dojazd` text NOT NULL, `inne` text NOT NULL, `procent` text NOT NULL, `opis` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Zrzut danych tabeli `test` -- INSERT INTO `test` (`numer`, `data`, `typ`, `robocizna`, `material`, `dojazd`, `inne`, `procent`, `opis`) VALUES (0, 0, 0, 0, 0, 0, 0, 0, 0);