#include <infodrom.style>

<page func="Infodrom Oldenburg" title="Zeitungen">

<?
  if ($_GET[oid] > 0) {
    $dbh = pg_pconnect ("<dbhost>", "<dbport>", "<dbname>")
		 or die("Unable to connect to SQL server");

    pg_exec ($dbh, "SET DateStyle = 'ISO'") or die("Datenbank-Abfrage!");

    $query = "SELECT * FROM zeitungen WHERE oid = '$_GET[oid]'";
    $sth = pg_exec ($dbh, $query) or die("Datenbank-Abfrage!");

    if (pg_NumRows ($sth) > 0) {
      $row = pg_fetch_array ($sth, 0);
    }
  } else {
    $row['type'] = 'tag';
    $row['city'] = 'Deutschland ()';
  }
?>

<form method=post action="update.php">
<input type=hidden name=oid value="<? echo $_GET[oid]; ?>">
<b>Typ:</b> <select name=type><?
  function sel ($mytype, $type, $descr)
  {
    printf ("<option value=\"%s\"%s>%s", $type, $mytype==$type?" selected":"", $descr);
  }

  sel ($row['type'], "tag", "Tageszeitung");
  sel ($row['type'], "utag", "Überregionale Tageszeitung");
  sel ($row['type'], "woche", "Wochenzeitung");
  sel ($row['type'], "uwoche", "Überregionale Wochenzeitung");
  sel ($row['type'], "monat", "Monatsmagazine");
  sel ($row['type'], "comp", "Computerzeitungen");
  sel ($row['type'], "misc", "Sonstiges");
  sel ($row['type'], "search", "Informationsstände");
?></select><br>
<b>URL:</b> <input name=url size=60 maxlength=120 value="<? echo $row['url']; ?>"><br>
<b>Name:</b> <input name=name size=60 maxlength=120 value="<? echo $row['name']; ?>"><br>
<b>Stadt:</b> <input name=city size=60 maxlength=120 value="<? echo $row['city']; ?>"><br>
<b>Text:</b> <br><textarea name=description rows=6 cols=67><? echo $row['description']; ?></textarea><p>

<? if ($_GET[oid] > 0) { ?>
<b>Delete:</b> <input name=delete type=radio value="1"> yes
<input name=delete type=radio value="0" checked> no<br>
<? } ?>

<p><center><input type=submit value="<? echo $_GET[oid]>0?"Update":"Insert"; ?>"></center><p>
</form>

</page>

# Local variables:
# mode: text
# mode: auto-fill
# end:
