variabel "forsvinder"
Jeg har stirret mig blind på min kode.. jeg har et id-nummer ($id) som sættes i starten af dokumentet... men variablen "forsvinder" når jeg kommer ind i if($submit).. sætningen - nogen der kan hjælpe mig henad mod en løsning?<?php
include ("dbconnect.php");
$id=$HTTP_GET_VARS["id"];
$query = mysql_query("SELECT * FROM `cns-dvd` WHERE id='$id'");
while($r = mysql_fetch_array($query))
{
$title = $r["title"];
$org_title = $r["org_title"];
$region = $r["region"];
$picture = $r["picture"];
$director = $r["director"];
$production_year = $r["production_year"];
$running_time = $r["running_time"];
$video_format = $r["video_format"];
$actor = $r["actor"];
$rating = $r["rating"];
$discs = $r["discs"];
}
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Language" content="dk-da">
<title>CNS DVD List</title>
<Link rel="stylesheet" Type="text/css" href="cns.css">
</head>';
echo "<form name=\"editdvd\" style=\"margin-bottom:0; margin-top:0;\" action=\"" . $PHP_SELF . "\" method=\"post\">
<table width=\"100%\"><tr><td width=\"150\"><b>Title:</b>
</td><td width=\"*\"><input type=\"text\" name=\"title\" size=\"50\" value=\"$title\">
</td></tr><tr><td width=\"150\"><b>Original Title:</b>
</td><td width=\"*\"><input type=\"text\" name=\"org_title\" size=\"50\" value=\"$org_title\">
</td></tr><tr><td width=\"150\"><b>Region:</b>
</td><td width=\"*\"><select name=\"region\">
<option value=\"0\" ";
if ($region == 0) echo "selected";
echo ">0 - Worldwide</option>
<option value=\"1\" ";
if ($region == 1) echo "selected";
echo ">1 - USA & Canada</option>
<option value=\"2\" ";
if ($region == 2) echo "selected";
echo ">2 - Europe & Japan</option>
<option value=\"3\" ";
if ($region == 3) echo "selected";
echo ">3 - Asia</option>
<option value=\"4\" ";
if ($region == 4) echo "selected";
echo ">4 - Australia</option>
<option value=\"5\" ";
if ($region == 5) echo "selected";
echo ">5 - Africa</option>
</select> <select name=\"picture\">
<option value=\"1\" ";
if ($picture == 1) echo "selected";
echo ">PAL</option>
<option value=\"1\" ";
if ($picture == 2) echo "selected";
echo ">NTSC</option>
</select>
</td></tr><tr><td width=\"150\"><b>Video format:</b>
</td><td width=\"*\"><select name=\"video_format\">";
$query2 = mysql_query("SELECT * FROM `cns-format`");
while ($r = mysql_fetch_array($query2))
{
echo "<option value=\"" . $r["id"] . "\" ";
if ($video_format == $r["id"])
echo "selected";
echo ">" . $r["format"] . " " . $r["description"] . "</option>";
}
echo "</select>
</td></tr><tr><td width=\"150\"><b>Number of discs:</b>
</td><td width=\"*\"><input type=\"text\" name=\"discs\" size=\"4\" maxlength=\"4\" value=\"$discs\">
</td></tr><tr><td width=\"150\"><b>Production year:</b>
</td><td width=\"*\"><input type=\"text\" name=\"production_year\" size=\"4\" maxlength=\"4\"
value=\"$production_year\">
</td></tr><tr><td width=\"150\"><b>Running time:</b>
</td><td width=\"*\"><input type=\"text\" name=\"running_time\" size=\"4\" maxlength=\"4\"
value=\"$running_time\"> min.
</td></tr></table><br>";
echo "<input type=\"submit\" name=\"submit\" value=\"Submit\"></form>";
if ($submit)
{
$finalquery = "UPDATE `cns-dvd` SET `region` = '$region', `picture` = '$picture', `title` = '$title',
`org_title` = '$org_title', `running_time` = '$running_time', `discs` = '$discs', `video_format` = '$video_format',
`production_year` = '$production_year' WHERE `id` = '$id'";
mysql_query($finalquery);
echo "descr: $finalquery";
}
/*
echo "<a href=\"editaudio.php?id=$id\" target=\"bottom\">Audio</a><br>
<a href=\"editsubs.php?id=$id\" target=\"bottom\">Subtitles</a><br>
<a href=\"editdirector.php?id=$id\" target=\"bottom\">Director</a><br>
<a href=\"editcast.php?id=$id\" target=\"bottom\">Cast</a><br>";
*/
echo "</html>";
?>
/Christian
