Hier:
http://go-around.de/admin_module/edit2.php?id=1555
Nochmal der überarbeitet Quelltext:
PHP-Code:
<?php
error_reporting(E_ALL);
ini_set('display_errors',1);
echo "Hello World";
include("../db.php");
$action = $_GET['action'];
$id = $_GET['id'];
if(!isset($action)) {
$abfrage = "SELECT * FROM SB WHERE id = $id LIMIT 1";
$ergebnis = mysql_query($abfrage);
while($row = mysql_fetch_object($ergebnis)) {
echo "
<form name='form1' method='post' action='edit.php?action=edit'>
<table width='300' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td>Ort</td>
<td><label>
<input name='Ort' type='text' id='Ort' value='$row->Ort'>
</label></td>
</tr>
<tr>
<td>Datum</td>
<td><input name='Datum' type='text' id='Datum' value='$row->Datum'></td>
</tr>
<tr>
<td>Airline</td>
<td><input name='Airline' type='text' id='Airline' value='$row->Airline'></td>
</tr>
<tr>
<td>Aircraft</td>
<td><input name='Typ' type='text' id='Typ' value='$row->Typ'> <input name='Reg' type='text' id='Reg' value='$row->Registration'></td>
</tr>
<tr>
<td>Fotograf</td>
<td><input name='Fotograf' type='text' id='Fotograf' value='$row->Fotograf'></td>
</tr>
<tr>
<td>Logbook</td>
<td><input name='logbook' type='text' id='logbook' value='$row->logbook'></td>
</tr>
<tr>
<td>DB</td>
<td><input name='db_name' type='text' id='db_name' value='$row->db_name'>
Name<br>
<input name='db_link' type='text' id='db_link' value='$row->db_link'>
Link</td>
</tr>
<tr>
<td>Link</td>
<td><input name='link' type='text' id='link' value='$row->link'>
groß
<input name='link_s' type='text' id='link_s' value='$row->link_s'>
klein</td>
</tr>
<tr>
<td>Besonderheit</td>
<td><select name='Besonderheit' size='1' id='Besonderheit'>
<OPTION SELECTED VALUE=''>All Categories
<OPTION VALUE='cargo'"; if($row->Besonderheiten==cargo) { echo " selected"; } echo ">Cargo Airliners
<OPTION VALUE='goverment'"; if($row->Besonderheiten==goverment) { echo " selected"; } echo ">Government Aircraft
<OPTION VALUE='military'"; if($row->Besonderheiten==military) { echo " selected"; } echo ">Military Aircraft
<OPTION VALUE='private'"; if($row->Besonderheiten==private) { echo " selected"; } echo ">Private Aircraft
<OPTION VALUE='business'"; if($row->Besonderheiten==business) { echo " selected"; } echo ">Business Aircraft
<OPTION VALUE=''>----------
<OPTION VALUE='cockpit'"; if($row->Besonderheiten==cockpit) { echo " selected"; } echo ">Cockpits
<OPTION VALUE='cabin'"; if($row->Besonderheiten==cabin) { echo " selected"; } echo ">Cabin Views
<OPTION VALUE='tail'"; if($row->Besonderheiten==tail) { echo " selected"; } echo ">Tail Wings / Winglets
<OPTION VALUE='nose'"; if($row->Besonderheiten==nose) { echo " selected"; } echo ">Nose Close-ups
<OPTION VALUE=''>----------
<OPTION VALUE='window_view'"; if($row->Besonderheiten==window_view) { echo " selected"; } echo ">Window Views
<OPTION VALUE='air_to_air'"; if($row->Besonderheiten==air_to_air) { echo " selected"; } echo ">Air to Air Photos
<OPTION VALUE='dark'"; if($row->Besonderheiten==dark) { echo " selected"; } echo ">Night Photos
<OPTION VALUE=''>----------
<OPTION VALUE='classic'"; if($row->Besonderheiten==classic) { echo " selected"; } echo ">Classic Airliners
<OPTION VALUE='preserved'"; if($row->Besonderheiten==preserved) { echo " selected"; } echo ">non-flying aircraft
<OPTION VALUE=''>----------
<OPTION VALUE='glider'"; if($row->Besonderheiten==glider) { echo " selected"; } echo ">Gliders
<OPTION VALUE='helicopter'"; if($row->Besonderheiten==helicopter) { echo " selected"; } echo ">Helicopters
<OPTION VALUE='blimp'"; if($row->Besonderheiten==blimp) { echo " selected"; } echo ">Airships/Blimps
<OPTION VALUE='seaplane'"; if($row->Besonderheiten==seaplane) { echo " selected"; } echo ">Seaplanes
<OPTION VALUE=''>----------
<OPTION VALUE='colorful_paint'"; if($row->Besonderheiten==colorful_paint) { echo " selected"; } echo ">Colorful Paint Schemes
<OPTION VALUE='special_paint'"; if($row->Besonderheiten==special_paint) { echo " selected"; } echo ">Special Paint Schemes
<OPTION VALUE=''>----------
<OPTION VALUE='airport'"; if($row->Besonderheiten==airport) { echo " selected"; } echo ">Airport Overviews
<OPTION VALUE='accident'"; if($row->Besonderheiten==accident) { echo " selected"; } echo ">Accidents / Incidents / Crashes
<OPTION VALUE='special_situations'"; if($row->Besonderheiten==special_situations) { echo " selected='selected'"; } echo ">Special Situations
</select>
</td>
</tr>
<tr>
<td width='100'>Kommentar</td>
<td><textarea name='Kommentar' id='Kommentar'>$row->Kommentar</textarea></td>
</tr>
<tr>
<td>Gallery</td>
<td><input name='Gallery' type='checkbox' id='Gallery' value='1'";
if($row->Gallery==1) { echo "checked"; }
echo "
></td>
</tr>
<tr>
<td>Spezial</td>
<td><input name='spezial' type='checkbox' id='spezial' value='1'";
if($row->spezial==1) { echo "checked"; }
echo "
></td>
</tr>
<tr>
<td>visible</td>
<td><label>
<input name='visible' type='checkbox' id='visible' value='1' ";
if($row->visible==1) { echo "checked"; }
echo "
>
</label></td>
</tr>
<tr>
<td>Bildtyp</td>
<td><input name='Bildtyp' type='text' id='Bildtyp' value='$row->Bildtyp'>
<input name='id' type='hidden' id='id' value='$_GET[id]'></td>
</tr>
</table>
<label>
<input type='submit' name='button' id='button' value='Senden'>
</label>
</form>
"; } }
if($action==edit) {
$Ort = $_POST['Ort'];
$Registation = $_POST['Reg'];
$Besonderheit = $_POST['Besonderheit'];
$Datum = $_POST['Datum'];
$Airline = $_POST['Airline'];
$Typ = $_POST['Typ'];
$Fotograf = $_POST['Fotograf'];
$logbook = $_POST['logbook'];
$db_link = $_POST['db_link'];
$db_name = $_POST['db_name'];
$link = $_POST['link'];
$link_s = $_POST['link_s'];
$Kommentar = $_POST['Kommentar'];
$Gallery = $_POST['Gallery'];
$spezial = $_POST['spezial'];
$Bildtyp = $_POST['Bildtyp'];
$visible = $_POST['visible'];
$id = $_POST['id'];
$query = "UPDATE SB SET Ort = '$Ort', Datum = '$Datum', Fotograf = '$Fotograf', Airline = '$Airline', visible = '$visible', Typ = '$Typ', logbook = '$logbook', db_link = '$db_link', db_name = '$db_name', link = '$link', link_s = '$link_s', Kommentar = '$Kommentar', Gallery = '$Gallery', spezial = '$spezial', Bildtyp = '$Bildtyp', Registration = '$Registation', Besonderheiten = '$Besonderheit' WHERE id = '$id' LIMIT 1";
$result=mysql_query($query);
if($result==true) { echo "Erfolgreich geupdatet"; }
else { echo "Es gab ein Problem beim update"; }
}
if($action==del)
{
echo "<form name='form1' method='post' action='edit.php?action=del_b'>
Bild $id<br />
Wirklich löschen?
<br>
<label>
<input type='submit' name='Löchen' id='Löchen' value='Löchen'>
</label>
<input name='id' type='hidden' id='id' value='$id'>
</form>
";
}
if($action==del_b) {
$query = "DELETE FROM SB WHERE id = $id LIMIT 1";
$result=mysql_query($query);
if($result==true) { echo "Erfolgreich gelöscht"; }
else { echo "Es gab ein Problem beim löschen"; }
}
?>