I am working on a php/mysql application that collects and stores important data about all the emergency calls that come into our fire station. Here is the link to the form that i have created that will collect the data :C.V.F.C. Report Sheet.
If you look on the C.V.F.C. Report Sheet, towards the bottom of the page you will see a list of all the members in our company that run calls, with a select box next to each name. each name and select box is generated by the following code:
<?php
function showerror()
{
die("Error " . mysql_errno() . " : " . mysql_error());
}
// Get Member Names & info From Database so it can be updated
$query = "SELECT * FROM members ORDER BY lastname";
require 'connect.php';
// If we made it here, then the data is valid
if (!($connection = @ mysql_pconnect($hostName, $username, $password)))
showerror();
if (!mysql_select_db($databaseName, $connection))
showerror();
// Place into niice tables!
echo "<div align=\"center\"><table width=\"75%\" border=\"1\" bordercolor=\"#FFFFFF\">";
$j = 0;
$rownum = 0;
$result = mysql_query($query);
if (($result = @ mysql_query ($query, $connection))){
while ($row = mysql_fetch_array($result)){
if($j == $rownum) {
echo "<tr>";
$rownum += 3;
}
echo "<td width=\"30%\"><font size=\"2\" face=\"Tahoma\">
<select name=\"" .$row['lastname'] . ", " . $row['firstname'] . "\">
<option>-----------</option>
<option name=\"$row['fire']\" >Fire Scene</option>
<option name=\"$row['drill']\" >Drill Scene</option>
<option name=\"$row['station']\" >Station</option>
</select>
" .$row['lastname'] . ", " . $row['firstname'] . "</td>";
++$j;
}
if($j == $rownum) {
echo "</tr>";
}
}
echo "</table></div>";
?>
Now, a user will select an option for each fireman that responded to the call. How can i send that data to a database??
The database keeps track of how many calls each member has made, and what type it was. i would need to determine which user made the call and then add '1' to the curent number in the database for the right type.
The database construction is below:
CREATE TABLE members (
id int(2) NOT NULL auto_increment,
firstname varchar(25) NOT NULL,
lastname varchar(25) NOT NULL,
rank varchar(25) NOT NULL,
totalcalls int(3) DEFAULT '0',
scene int(3) DEFAULT '0',
station int(3) DEFAULT '0',
drills int(2) DEFAULT '0',
PRIMARY KEY (id, lastname, firstname)
);
I have no clue how to do this?!? or if it is even possible?
i don't know any other alternatives, i am open for seggestions.
if anyone could direct me in the right direction at all, I would greatly appreciate your help! Thank-you!