Location: PHPKode > projects > Mozart > Mozart-0.0.4/newtypes.php
<?
include("connect.inc");
include("reqlogin.inc");
include("userprefs.inc");
?>
<html>
<title>Add New Types Table</title>
<body bgcolor=<? echo $userdata["bgcolor"] ?> text=<? echo $userdata["txtcolor"]?>>
<?
include("links.inc");
?>
<center>
<b>Add Types</b>
<?
print("<br><br><font color=red>$Message</font><br>");

$ExistSQL = "SELECT type_id, type_source, type_name FROM types ORDER BY type_source, type_name";
$Exist    = mysql_query($ExistSQL);

$TypesSQL = "SELECT DISTINCT type_source FROM types ORDER BY type_source";
$Types    = mysql_query($TypesSQL);
?>
<table border=0 cellspacing=10 cellpadding=0>
<tr><td>
<table border=1 cellspacing=0 cellpadding=0>
<caption><b>Existing Types</b></caption>
<th>Table</th>
<th>Type</th>
<?
while ($existing = mysql_fetch_array($Exist)) {
   printf("<tr><td>%s</td><td>%s</td><td><a href=\"updtype.php?id=%s\">Update</a></td><td><a href=\"deltype.php?id=%s\">Delete</a></td></tr>", $existing["type_source"], $existing["type_name"], $existing["type_id"], $existing["type_id"]);
}
?>
</table>
</td>
<td>
<form action="instype.php" method="post">
<table border=1 cellspacing=0 cellpadding=0>
<caption><b>New Types</b></caption>
<th>Table</th>
<th>New Type</th>
<tr>
<?
$y = 1;
while ($types = mysql_fetch_array($Types)) {
  $type_array[$y] = $types["type_source"];
  $y++;
}
$x = 1;
while ($x <= 10) {
  printf("<tr><td><select name=TypeSource[%s]>", $x);
  $z = 1;
  while ($z < $y) {
    printf("<option>%s", $type_array[$z]);   
    $z++;
  }
  print("</select></td>");
  printf("<td><input type=text name=NewType[%s]></td></tr>", $x);
  $x++;
}
?>
<tr><td><input type=submit value="Add"></td>
<td><input type=reset value="Reset"></td></tr>
</table>
</table>
</form>
<?
include("links.inc");
?>
</body>
</html>
Return current item: Mozart