<?php
if (!IsSet($_POST["test"]))
{
//form that displays users that are in the database currently available to the end user
?>
<FORM METHOD=POST ACTION="hello.php">
<p>
<SELECT NAME="test" SIZE=5 MULTIPLE>
<?php
/* Open connection to the database */
mysql_connect("localhost", "user", "password") or die("<OPTION>Database error!</OPTION></SELECT>");
mysql_select_db("announcementdb");
/* Download list of users */
$query = "SELECT * FROM announcedb ORDER BY SLNAME";
$result = mysql_query($query);
while($myrow = mysql_fetch_array($result))
{
//displays the results of the query
print("<OPTION VALUE=\"$myrow[0]\" SELECTED>$myrow[1], $myrow[2], $myrow[3],$myrow[4],$myrow[5],$myrow[6]\n");
}
?>
</SELECT>
</p>
<p>
<INPUT TYPE=SUBMIT>
<input name="test" type="hidden" value="">
</p>
</FORM>
<?php
}
if (IsSet($_POST["test"]))
{
//this oortion of the code I grabbed from the php 4 bible. this is the only portion I am having problems with.
while(list($key, $val) = each($_POST["test"]))
{
/*this was just so I could see what format it was going to spitting the information from
the select box out and then create a mysql query around it*/
print $val.', '.$email."another test";
}
}
?>