Updated my code a bit (trying many things)
As it is right this moment, the script displays all events with all IDs, not just where $id=$dep_id...
<html>
<head>
<title>Add Participants</title>
</head>
<body>
<?php
// Connect to database
$connect= mysql_connect("localhost","root")
or die("Could not connect to database in localhost !");
mysql_select_db("testdiw")
or die("Could not select that database !");
$id = $_GET['id'];
$query = "SELECT * FROM diw_alpha WHERE id = '$id'";
$result = mysql_query($query);
$row = mysql_fetch_array($result);
echo '
<TABLE BORDER="0" width=600 cellspacing=0>
<form name="form3" method="post">
<TR>
<TD> ID</TD>
<TD>'.$row['id'].'</TD>
<TR>
<TR>
<TD>Title</TD>
<TD>'.$row['diwtitle'].'</TD>
<TR>
<TD colspan=2> <CENTER>
<select name="name" tabindex="4"><option value="-notset-">- Select a participant -</option> ';
//--- CREATE VIDEOGRAPHY COMPANY SELECT ---
$sql = "SELECT DISTINCT name FROM part_name ORDER BY name";
$name = mysql_query($sql) or die($sql . '<br />' . mysql_error());
while ($row = mysql_fetch_array($name)) {
echo '<option value="' . $row['name'] . '">' . $row['name'] . '</option>';
}
;
echo ' </CENTER></TD>
</TR>
<TR>
<TD COLSPAN=2><BR><CENTER><input type="submit" name="Submit" value="Submit" action="required"></CENTER></TD></FORM>
</TR>
</TABLE> ';
?>
<?PHP
$connect= mysql_connect("localhost","root")
or die("Could not connect to database in localhost !");
$result=mysql_select_db("testdiw")
or die("Could not select that database !");
$sqlquery = "INSERT INTO attendees VALUES('', '". $_POST['name'] ."', '". $_POST['dep_id'] ."')";
$queryresult = mysql_query($sqlquery) or die(" Could not execute mysql query !");
$sqlquery = "SELECT * from attendees";
$id = $row['id'];
$id = $HTTP_POST_VARS['dep_id'];
$sqlquery1 = "SELECT participant_id, name FROM attendees where dep_id = '$id' ORDER BY name";
$queryresult1 = mysql_query($sqlquery1) or die(" Could not execute mysql query #2 !");
$row = mysql_fetch_row($queryresult1);
$participant_id = $row[0];
$name = $row[1];
$byebye = $row[2];
$tdcount = 1;
$numtd = 1; // number of cells per row
echo '
<TABLE width="48%" ALIGN="left" CELLSPACING=2>
<tr>
<>Participant ID </td>
<> Participant Name</td>
<> Action</td>';
while($row = mysql_fetch_array($queryresult1)) {
if ($tdcount == 1) echo "<tr>";
echo '<td> '.$row['participant_id'],'</td><td>'.$row['name'].'</td><td><a href="?participant_id='.$row['participant_id'],'&action=delete">Delete</a></td>';
if ($tdcount == $numtd) {
echo "</tr>";
$tdcount = 1;
} else {
$tdcount++;
}
}
// time to close up our table
if ($tdcount!= 1) {
while ($tdcount <= $numtd) {
echo "<td> </td>";
$tdcount++;
}
echo "</tr>";
}
echo '
</table> ';
?>