początek strony:
<?php $category = $_GET['category']; $database = './../db/'.$category.'.db'; { exit; } $count = 0; $kodindex = -1; foreach($items as $line) { $fotos[$count] = $foto; $nosniks[$count] = $nosnik; $miejscowoscs[$count] = $miejscowosc; $adress[$count] = $adres; $stronys[$count] = $strony; $termins[$count] = $termin; $statuss[$count] = $status; $wynajmujacys[$count] = $wynajmujacy; $kwotas[$count] = $kwota; $kodindex = $count; $count++; } { if ($action == 'delete') { if ($kodindex == -1) { exit; } for ($i=0; $i < $count; $i++) { if ($i != $kodindex) { } } exit; } else if ($action == 'update') { for ($i=0; $i < $count; $i++) { if ($i == $kodindex) { $fotos[$i] = $_POST['foto']; $nosniks[$i] = $_POST['nosnik']; $miejscowoscs[$i] = $_POST['miejscowosc']; $adress[$i] = $_POST['adres']; $stronys[$i] = $_POST['strony']; $termins[$i] = $_POST['termin']; $statuss[$i] = $_POST['status']; $wynajmujacys[$i] = $_POST['wynajmujacy']; $kwotas[$i] = $_POST['kwota']; } } exit; } else if ($action == 'create') { for ($i=0; $i < $count; $i++) exit; } } ?>
oraz sama tabela:
<?php { if (($action == 'edit') || ($action == 'new')) { $foto_value = ($kodindex == -1) ? "" : $fotos[$kodindex]; $nosnik_value = ($kodindex == -1) ? "" : $nosniks[$kodindex]; $miejscowosc_value = ($kodindex == -1) ? "" : $miejscowoscs[$kodindex]; $adres_value = ($kodindex == -1) ? "" : $adress[$kodindex]; $strony_value = ($kodindex == -1) ? "" : $stronys[$kodindex]; $termin_value = ($kodindex == -1) ? "" : $termins[$kodindex]; $status_value = ($kodindex == -1) ? "" : $statuss[$kodindex]; $wynajmujacy_value = ($kodindex == -1) ? "" : $wynajmujacys[$kodindex]; $kwota_value = ($kodindex == -1) ? "" : $kwotas[$kodindex]; if ($action == 'new') { $foto_value = ($kodindex == -1) ? "" : $fotos[$kodindex]; $nosnik_value = ($kodindex == -1) ? "" : $nosniks[$kodindex]; $miejscowosc_value = ($kodindex == -1) ? "" : $miejscowoscs[$kodindex]; $adres_value = ($kodindex == -1) ? "" : $adress[$kodindex]; $strony_value = ($kodindex == -1) ? "" : $stronys[$kodindex]; $termin_value = ($kodindex == -1) ? "" : $termins[$kodindex]; $status_value = ($kodindex == -1) ? "" : $statuss[$kodindex]; $wynajmujacy_value = ($kodindex == -1) ? "" : $wynajmujacys[$kodindex]; $kwota_value = ($kodindex == -1) ? "" : $kwotas[$kodindex]; } else { } echo "<td><input type=\"text\" size=\"50\" name=\"foto\" value=\"" . $foto_value. "\"></td></tr>\n"; echo "<td><input type=\"text\" size=\"50\" name=\"nosnik\" value=\"" . $nosnik_value . "\"></td></tr>\n"; echo "<td><input type=\"text\" size=\"50\" name=\"miejscowosc\" value=\"" . $miejscowosc_value . "\"></td></tr>\n"; echo "<td><input type=\"text\" size=\"50\" name=\"adres\" value=\"" . $adres_value . "\"></td></tr>\n"; echo "<td><select name=\"strony\" size=\"1\"><option " . ($strony_value == "0" ? "selected " : "") . "value=\"1\">Nośnik jednostronny</option><option " . ($strony_value == "0" ? "selected " : "") . "value=\"2\">Nośnik dwustronny</option></select></td></tr>\n"; echo "<td><input type=\"date\" size=\"50\" name=\"termin\" value=\"" . $termin_value . "\"></td></tr>\n"; echo "<td><select name=\"status\" size=\"1\"><option " . ($status_value == "0" ? "selected " : "") . "value=\"0\">Wynajęty / zarezerwowany / niedostępny</option><option " . ($status_value == "0" ? "selected " : "") . "value=\"1\">1 ekran do wynajęcia</option><option " . ($status_value == "0" ? "selected " : "") . "value=\"2\">2 ekrany do wynajęcia (billboard dwustronny)</option></select></td></tr>\n"; echo "<td><input type=\"text\" size=\"50\" name=\"wynajmujacy\" value=\"" . $wynajmujacy_value . "\"></td></tr>\n"; echo "<td><input type=\"text\" size=\"50\" name=\"kwota\" value=\"" . $kwota_value . "\"></td></tr>\n"; echo "<tr><td> </td><td align=\"left\"><input type=\"submit\" name=\"cmdSubmit\" value=\"Zapisz\">"; } } else { for ($i=0; $i < $count; $i++) { echo "<td><a href='./../db/images/" . $fotos[$i] ."' rel='fancy' title='" . $nosniks[$i] . " - billboard " . $stronys[$i] . "-stronny. " . $miejscowoscs[$i] . ", " . $adress[$i] . "' target='_self'><img height='70px' width='realtive' src='./../db/images/" . $fotos[$i] . "'></a></td>\n"; } } ?>
z góry dziękuję za zainteresowanie