Location: PHPKode > projects > Einkaufszettelgenerator > EZettel0.1/menu_to_db.php
<?
session_start();
$us= $HTTP_SESSION_VARS['uid'];
//echo "user=$us<br>"; 
?>
<HTML>

<LINK REL="stylesheet" TYPE="text/css" HREF="menu.css">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Menu - to db</title>

</head>
<body class="body1">
<?
include("menu.ini"); 

if ($_POST[tag]=='Понедельник'){ $tag=1;}
if ($_POST[tag]=='Вторник'){ $tag=2;}   
if ($_POST[tag]=='Среда'){ $tag=3;} 
if ($_POST[tag]=='Четверг'){ $tag=4;} 
if ($_POST[tag]=='Пятница'){ $tag=5;} 
if ($_POST[tag]=='Суббота'){ $tag=6;} 
if ($_POST[tag]=='Воскресенье'){ $tag=7;} 

foreach ($_POST[speise_name] as $v)
{


 $strsql = "insert into menu (tag, speise_id, user_id) VALUES ('$tag','$v', '$us');";

 $result = mysql_query($strsql, $connection);  
}

echo "<TABLE BORDER=1 class=menu cellpadding=4 cellspacing=4 align=center>";


  $strsql_5 = "select distinct tag from menu order by tag;"; 
 $result_5 = mysql_query($strsql_5, $connection);
   $r=0;
  while ( $row_5 = mysql_fetch_row($result_5) )
   {
 $r+=1;
 echo "<TR ><TD valign=top><B>";
if ($row_5[0] =='1'){ echo "Понедельник";}
if ($row_5[0] =='2') { echo "Вторник";}   
if ($row_5[0] =='3'){ echo "Среда";}   
if ($row_5[0] =='4'){ echo "Четверг";}   
if ($row_5[0] =='5'){ echo "Пятница";}   
if ($row_5[0] =='6'){ echo "Суббота";}   
if ($row_5[0] =='7'){ echo "Воскресенье";}   

echo "</td><td>";

$strsql_6 = "select p.speise_name,  p.speise_id  from  speise p,  menu t where ( (t.tag='$row_5[0]') and (p.speise_id=t.speise_id) and (p.user_id='$us') and (t.user_id='$us') );";
 
//echo "str=$strsql_6<br>";
 
  $result_6 = mysql_query($strsql_6, $connection);
  $y=0;
 while ( $row_6 = mysql_fetch_row($result_6) )
  {
 $y+=1;
 echo "<a href=speise.php?speise_id=$row_6[1] target=blank>$row_6[0]</a> <a href=speise_aus_menu.php?speise_id=$row_6[1]&tag=$row_5[0]><font size=-2>удалить из меню</font></a><BR> ";

  }
echo "</TD></TR>";
   }
 $strsql_7 = "select distinct speise_id from menu;";
 $result_7 = mysql_query($strsql_7, $connection);
   $p=0;
  while ( $row_7 = mysql_fetch_row($result_7) )
   {
 $p+=1;
  $strsql_8 = "select distinct prod_id from teil where (speise_id='$row_7[0]');";
  
  //echo "str=$strsql_8<br>";
 $result_8 = mysql_query($strsql_8, $connection);
   $q=0;
  while ( $row_8 = mysql_fetch_row($result_8) )
   {
 $q+=1;
$strsql_9 = "UPDATE  product set sel='Yes' where (prod_id='$row_8[0]');";
//echo "str_9=$strsql_9<br>";
$result_9 = mysql_query($strsql_9, $connection);    
  }
}


?>
</TABLE>
<center><A HREF=input_menu.php>Выбрать меню</a>&nbsp;&nbsp;<A HREF=start.php>На первую страницу</a></center>      

</HTML> 
Return current item: Einkaufszettelgenerator