<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
  <title>Browse How-To Database</title>
  <LINK REL="stylesheet" HREF="/PHP/style.css">
  <META NAME="author"      CONTENT="Denice Deatrich">
  <META NAME="description" CONTENT="PHP web-based MySQL DB Management">
  <META NAME="keywords"    CONTENT="PHP web MySQL database">
</head>

<body>
  <h1>How-To Database</h1>
<?php
  
function showForm( $arr, $arg )
  {
    echo
"
    <table width=300 cols=4>
    <tr>
      <td colspan=3><h2>Browse full record:</h2></td>
      <td nowrap>
      <font color=\"red\" size=-1><select name=\"option-$arg\">
      <option value=\"modify\">Modify
      <option value=\"delete\">Delete
      </select><input type=\"submit\" name=\"$arg\" value=\"Go\">
      </font>
      </td>
    </tr>
    <tr>
      <td>Topic:</td>
      <td nowrap>
      <input name=\"topic\" size=30 maxlength=30 value=\"$arr[1]\">
      </td>
      <td>&nbsp;&nbsp;OS:</td>
      <td>
      <select name=\"os\">"
;
      
$osii = array( "unix", "*", "linux", "solaris", "hp-ux",
       
"windows", "WinNT" );
      for(
$i= 0; $i < sizeof($osii); $i++ ) {
        echo
"<option value=\"$osii[$i]\"";
        if(
$osii[$i] == $arr[2] ) {
          echo
" selected>$osii[$i]";
        }
        else {
          echo
">$osii[$i]";
        }
      }
      echo
"</select>
      </td>
    </tr>
    <tr>
      <td>Ver:</td>
      <td>
        <input name=\"ver\" size=10 maxlength=10 value=\"$arr[3]\">
      </td>
      <td>&nbsp;&nbsp;Arch:</td>
      <td>
      <select name=\"arch\">"
;
      
$arches = array( "*", "intel", "sparc", "pa-risc" );
      for(
$i= 0; $i < sizeof($arches); $i++ ) {
        echo
"<option value=\"$arches[$i]\"";
        if(
$arches[$i] == $arr[4] ) {
          echo
" selected>$arches[$i]";
        }
        else {
          echo
">$arches[$i]";
        }
      }
      echo
"</select>
      </td>
    </tr>

    <tr>
      <td>Keywords:</td>
      <td>
      <input name=\"keywords\" size=30 maxlength=30 value=\"$arr[5]\">
      </td>
      <td></td>
      <td><input type=\"reset\" value=\"Reset Data\"></td>
    </tr>
    </table>
    Notes:<BR>
    <textarea name=\"notes\" rows=10 cols=80>$arr[6]</textarea>"
;
  }
// end of function showForm()

  
require( "db_connect.php" );
  
$loop = true;
  
$act = "none";
  if(
$argv ) { // then SELF called with sort, next or search argument(s).
    
$arg = $argv[0];
    if( (
$link=mysql_pconnect($DB_HOST, $DB_USER, $DB_PW)) ) {
      
$q = "select * from how_to where rowid = " . $arg;
      if(
$res=mysql_db_query($DB_NAME, $q, $link) ) {
        if(
$row = mysql_fetch_array($res, MYSQL_NUM) ) {
          echo
"<form action=\"/PHP/db/db_process.php?$arg\" method=\"post\">";
          
showForm( $row, $arg );
          echo
"</form>";
        }
        else {
          
printError( "Fetch", $link );
        }
      }
      else {
        
printError( "Query", $link );
      }
    }
    else {
      
printf( "Connect: %s: %s\n<BR>", mysql_errno(), mysql_error() );
    }
  }
?>
  <hr>
  <div class="footer">
  <address>
    <a href="mailto&#058;Denice&#046;Deatrich&#064;epfl.ch">Denice Deatrich</a>
  </address>
<!-- Created: Sun Jan 16 17:22:34 MET 2000 -->
<!-- hhmts start -->
Last modified: Tue Jun  6 23:45:56 MEST 2000
<!-- hhmts end -->
  </div>
</body>
</html>