I am not sure if it is... On page 1 of my script, I enter a few variables and select a participant in a drop down list. Page 2 displays the information I selected on the form from page 1.
I was hoping to be able to select more than one participant on page 1, and list them all at the bottom of the page, but I am not sure how to go about it. Right now, current code shows all entries in the table, since I cannot narrow it down by ID in the query (there isn;t one on page 1)
I am not sure what's the next step, whether it's a session, or if there is a way to select them on page 1 another way.
Any ideas what I can try?
Thanks 🙂
Code of page 1:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional">
<html>
<head>
</head>
<body>
<?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 !");
echo '<form action="testing2.php" method="post">
<TABLE>
<TR>
<TD>DIW Title:</TD>
<TD><input type="text" name="diwtitle" size="32"></TD>
</TR>
<TR>
<TD>Deponent Information:</TD>
<TD><select name="dropdowndeponent" tabindex="4"><option value="notset">- Select a deponent -</option> ';
//--- CREATE SELECT ---
$sql = "SELECT DISTINCT deponentname FROM deponent ORDER BY deponentname";
$deponentname = mysql_query($sql) or die($sql . '<br />' . mysql_error());
while ($row = mysql_fetch_array($deponentname)) {
echo '<option value="' . $row['deponentname'] . '">' . $row['deponentname'] . '</option>';
} ;
echo '</select></TD>
</TR>
<TR>
<TD>Deposition Status</TD>
<TD><select name="depstatus">
<option value="In Progress" selected>In Progress</option>
<option value="Scheduled">Scheduled</option>
<option value="Awaiting Billing">Awaiting Billing</option>
<option value="Post-Production">Post-Production</option>
<option value="Completed">Completed</option></select></TD>
</TR>
<TR>
<TD width="20%"><b><font face="Tahoma" size=2>Deposition Participants</font></B></TD>
<TD>
<select name="participant_id" tabindex="4"><option value="-notset-">- Select a participant -</option> ';
//--- CREATE 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 ' </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['company_id'] ."')";
$queryresult = mysql_query($sqlquery) or die(" Could not execute mysql query !");
$sqlquery = "SELECT * from attendees";
?>
<?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 !");
$sqlquery1 = "SELECT participant_id, company_id FROM attendees ORDER BY company_id";
$queryresult1 = mysql_query($sqlquery1) or die(" Could not execute mysql query !");
$row = mysql_fetch_row($queryresult1);
$participant_id = $row[0];
$company_id = $row[1];
$byebye = $row[2];
$tdcount = 1;
$numtd = 1; // number of cells per row
echo '
<TABLE width="48%" ALIGN="left" CELLSPACING=2>
<tr>
<td >Participant ID </td>
<td> Participant Name</td>
<td> Action</td>';
while($row = mysql_fetch_array($queryresult1)) {
if ($tdcount == 1) echo "<tr>";
echo '<td> '.$row['participant_id'],'</td><td>'.$row['company_id'].'</b></font></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> ';
?>