<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">



</head>

<body>



<?php
include("functions.php");
	dbConnect();
?>



<table width="500" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  <tr>
    <td width="14" height="2"></td>
    <td width="194"></td>
    <td width="72"></td>
    <td width="121"></td>
    <td width="99"></td>
  </tr>
  <tr>
    <td height="19"></td>
    <td valign="top">ADMINISTRATIONSPANEL</td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="11"></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="22"></td>
    <td valign="top"><strong>L&auml;gga till produkt: </strong></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="13"></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="144"></td>
    <td colspan="3" valign="top">
	  <form method="post" action="resultat.php">
	    Rubrik&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	      <INPUT TYPE="text" NAME="rubrik" SIZE="30">
    
<br>Beskrivning
    <INPUT TYPE="text" NAME="beskrivning" SIZE="30">
    
<br>
Pris&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <INPUT TYPE="text" NAME="pris" value="förfrågan" SIZE="30">
    
<br>
Modell&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <INPUT TYPE="text" NAME="modell" value="förfrågan" SIZE="30">
    
<br>Bild&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <INPUT TYPE="text" NAME="bild" value=".jpg" SIZE="30">
    <br>
    Kategori&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <select name="kategori" size="1">
      <?php $query="SELECT * FROM `kategorier`";
	$result=mysql_query($query);
	while ($line= mysql_fetch_array($result, MYSQL_ASSOC)) {
    $row=(array_values($line));
		?>
      <option><?php print $row[1]; }; ?>
      
</select>
    

    <INPUT TYPE="submit" value="Lägg till">
                        </form></td>
    <td></td>
  </tr>
  <tr>
    <td height="14"></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="20"></td>
    <td colspan="2" valign="top"><strong>&Auml;ndra produkt-detaljer:</strong></td>
    <td>&nbsp;</td>
    <td></td>
  </tr>
  <tr>
    <td height="13"></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="245"></td>
    <td colspan="3" valign="top">

<form action="index.php">
      <select name="rubrik">
      <?php 

$result2=mysql_query("select Rubrik from produkt") or die("Kunde inte välja databasen");
 while($line2 = mysql_fetch_array($result2, MYSQL_ASSOC)){
 $row2=array_values($line2);
 ?>
       <option><?php print $row2[0] ?></option>
       <?php
}
?>
      <input type="submit" value="Välj Produkt">
</form><?php

if(isset($_GET["rubrik"])){
test();
}

?>

<?php
function test(){
$variabel=$_GET['rubrik'];
?>
<form method="post" action="resultat2.php">
      <?php
$result=mysql_query("select * from produkt where Rubrik = '$variabel'") or die("Kunde inte välja databasen");
$line = mysql_fetch_array($result, MYSQL_ASSOC);
  $row=array_values($line);
	?>
		<input type="hidden" name="id" value="<?php print $row[0] ?>"><br>
        Rubrik&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="rubrik" value="<?php print $row[1] ?>"><br>
        Beskrivning&nbsp;<input type="text" name="beskrivning" value="<?php print $row[2] ?>"><br>
        Pris&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="text" name="pris" value="<?php print $row[3] ?>"><br>
        Modell&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="text" name="modell" value="<?php print $row[4] ?>"><br>
        Bild&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="bild" value="<?php print $row[5] ?>"><br>
		
		Kategori&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<select name="kategori" size="1">
      <?php $query="SELECT * FROM `kategorier`";
	$result3=mysql_query($query);
	while ($line3= mysql_fetch_array($result3, MYSQL_ASSOC)) {
    $row3=(array_values($line3));
		?>
      <option <?php if($row3[0]==$row[6]){echo "selected";} ?>>
	  <?php print $row3[1]; }; ?>
      
</select>
      <input type="submit" value="Ändra">
</form><?php } ?></td>
    <td></td>
  </tr>
  <tr>
    <td height="32"></td>
    <td>&nbsp;</td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="23"></td>
    <td colspan="3" valign="top"><strong>Ta bort produkt </strong></td>
    <td></td>
  </tr>
  <tr>
    <td height="22"></td>
    <td>&nbsp;</td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
  <tr>
    <td height="61"></td>
    <td colspan="3" valign="top">
	<form action="resultat3.php" method="post">
	<select name="produkt">
	<?php 

$result3=mysql_query("select Rubrik from produkt") or die("Kunde inte välja databasen");
 while($line3 = mysql_fetch_array($result3, MYSQL_ASSOC)){
 $row3=array_values($line3);
 ?>
       <option><?php print $row3[0] ?></option>
       <?php
}
?>
	</select>
	
	<input type="submit" value="Ta bort">
	</form>
	</td>
    <td></td>
  </tr>
  <tr>
    <td height="134"></td>
    <td>&nbsp;</td>
    <td></td>
    <td></td>
    <td></td>
  </tr>
</table>
</body>

</html>