Location: PHPKode > projects > Computer Service Company Database > SOLOCMS/dogbert/createtag1.php
<? include ('db.php'); ?>
<? include ('header.php'); ?>
<table width="750" border="0" align="center">
  <tr>
    <td><br>
      <?php

     $msg = ''; // default empty message

// get the list of clients so you can attach a service tag to them
     
	 $sql11 = "SELECT id, firstname, lastname FROM results ORDER BY lastname ASC";
     $res_cat11 = mysql_query($sql11); // handle to category set

// grab all the current drivers by catagory so you can choose a driver for each category
	 
	 $sql = "SELECT id, name FROM drivers WHERE cat='Video'";
     $res_cat = mysql_query($sql); // handle to category set
      $sql2 = "SELECT id, name FROM drivers WHERE cat='MB'";
     $res_cat2 = mysql_query($sql2); // handle to category set
      $sql3 = "SELECT id, name FROM drivers WHERE cat='LAN'";
     $res_cat3 = mysql_query($sql3); // handle to category set
      $sql4 = "SELECT id, name FROM drivers WHERE cat='Sound'";
     $res_cat4 = mysql_query($sql4); // handle to category set
      $sql5 = "SELECT id, name FROM drivers WHERE cat='Modem'";
     $res_cat5 = mysql_query($sql5); // handle to category set
      $sql6 = "SELECT id, name FROM drivers WHERE cat='SCSI'";
     $res_cat6 = mysql_query($sql6); // handle to category set
      $sql7 = "SELECT id, name FROM drivers WHERE cat='Other1'";
     $res_cat7 = mysql_query($sql7); // handle to category set
      $sql8 = "SELECT id, name FROM drivers WHERE cat='Other2'";
     $res_cat8 = mysql_query($sql8); // handle to category set
      $sql9 = "SELECT id, name FROM drivers WHERE cat='Other3'";
     $res_cat9 = mysql_query($sql9); // handle to category set
      $sql10 = "SELECT id, name FROM drivers WHERE cat='Other4'";
     $res_cat10 = mysql_query($sql10); // handle to category set
	 
// form is submitted  enter the drviers into the databse   
if (!empty($_POST)) { 
          $sql = "INSERT INTO servicetag (clientid, vid,mb,lan,sound,modem,scsi,other1,other2,other3,other4) VALUES ('$clientid','$vid','$mb','$lan','$sound','$modem','$scsi','$other1','$other2','$other3','$other4')";
          $res_add = mysql_query($sql) or die (mysql_error()); // exec query
          $msg  = "Service Tag Created<br>";
          $msg .= "Service ID: ". mysql_insert_id();     }
?>
      <h1>Create The service tag Here. Leave it blank if there is no driver for the catagory. </h1>
	              <form action="" method="POST">
        <p align="center" class="invoice"><?php echo $msg; ?>
          <select name="clientid">
            <option value="1" selected>-</option>
            <?php while ($row = mysql_fetch_assoc($res_cat11)) { ?>
            <option value="<?php echo $row['id']; ?>"><?php echo $row['lastname']; ?> - <?php echo $row['firstname']; ?></option>
            <?php } ?>
          </select>
Client Name </p>
        <table width="100%"  border="0">
          <tr>
            <td width="50%" valign="top" class="invoice"><p>
              <select name="vid">
                  <option value="">-</option>
                  <?php while ($row = mysql_fetch_assoc($res_cat)) { ?>
                  <option value='<?php echo $row['id']; ?>'><?php echo $row['name']; ?></option>
                  <?php } ?>
                </select>
  Video Driver </p>
              <p>
                <select name="mb">
                  <option value="">-</option>
                  <?php while ($row = mysql_fetch_assoc($res_cat2)) { ?>
                  <option value='<?php echo $row['id']; ?>'><?php echo $row['name']; ?></option>
                  <?php } ?>
                </select>
  MB Driver </p>
              <p>
                <select name="lan">
                  <option value="">-</option>
                  <?php while ($row = mysql_fetch_assoc($res_cat3)) { ?>
                  <option value='<?php echo $row['id']; ?>'><?php echo $row['name']; ?></option>
                  <?php } ?>
                </select>
  LAN Driver </p>
              <p>
                <select name="sound">
                  <option value="">-</option>
                  <?php while ($row = mysql_fetch_assoc($res_cat4)) { ?>
                  <option value='<?php echo $row['id']; ?>'><?php echo $row['name']; ?></option>
                  <?php } ?>
                </select>
  Sound Driver</p>
              <p>    <select name="modem">
        <option value="">-</option>
        <?php while ($row = mysql_fetch_assoc($res_cat5)) { ?>
        <option value='<?php echo $row['id']; ?>'><?php echo $row['name']; ?></option>
        <?php } ?>
      </select>
    Modem Driver </p></td>
            <td width="50%" valign="top" class="invoice"><p>
              <select name="scsi">
                  <option value="">-</option>
                  <?php while ($row = mysql_fetch_assoc($res_cat6)) { ?>
                  <option value='<?php echo $row['id']; ?>'><?php echo $row['name']; ?></option>
                  <?php } ?>
                </select>
  SCSI Driver </p>
              <p>
                <select name="other1">
                  <option value="">-</option>
                  <?php while ($row = mysql_fetch_assoc($res_cat7)) { ?>
                  <option value='<?php echo $row['id']; ?>'><?php echo $row['name']; ?></option>
                  <?php } ?>
                </select>
  Other Software 1 </p>              <select name="other2">
                <option value="">-</option>
                <?php while ($row = mysql_fetch_assoc($res_cat8)) { ?>
                <option value='<?php echo $row['id']; ?>'><?php echo $row['name']; ?></option>
                <?php } ?>
                                </select>
  Other Software 2 
  <p>
                <select name="other3">
                  <option value="">-</option>
                  <?php while ($row = mysql_fetch_assoc($res_cat9)) { ?>
                  <option value='<?php echo $row['id']; ?>'><?php echo $row['name']; ?></option>
                  <?php } ?>
                </select>
  Other Software 3 </p>
              <p>
                <select name="other4">
                  <option value="">-</option>
                  <?php while ($row = mysql_fetch_assoc($res_cat10)) { ?>
                  <option value='<?php echo $row['id']; ?>'><?php echo $row['name']; ?></option>
                  <?php } ?>
                </select>
  Other Software 4 </p></td>
          </tr>
        </table>
        <p>
          <input type="submit" name="submit" value="Create Service Tag">
          <input type="hidden" name="submit" value="Create Service Tag">
      </p>
	  </form></td>
  </tr>
</table>
<? include ('navigation.php'); ?>
<? include ('footer.php'); ?>
Return current item: Computer Service Company Database