hey guys,
I am working on a php/mysql application that collects and stores important data about all the emergency calls that come into our station. Here is the link to the form that i have created that will collect the data C.V.F.C. Report Sheet.
I am not sure how to send and collect certian parts of the data that is going to be provided by the user.
There are three main things i am having trouble with.
1) to me, seems to be the most troubling.
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. This list of names 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; //<------- REPLACE 2 WITH NUMBER OF RECORDS PER ROW
}
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; // <---- Yes this is right See below
}
if($j == $rownum) {
echo "</tr>";
}
}
echo "</table></div>";
?>
How can I send this data if the user selects an option for multipul members? 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)
);
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. I have no clue how to do this?!? do you? I'd really appreciate your help!
2) On the C.V.F.C. Report Sheet Under the title "Vehicles and Drivers" I have a checkbox for each of our apparatus with a textfield across from it. Now i'm not sure how i should collect or how to store this data? because there can be multipul checks and and drivers. how can I 1) pull this data and organize it together, and 2) what would be the most effecient way to store this into a mysql database?
and finially probally the easiest part of my question...
3) On the C.V.F.C. Report Sheet Under "Type of Alarm" at the bottom. How can I collect the data about the option selected?? Only one option is allowed.
Woah! This is a really lenghty post.. Sorry! I really would appreciate any help anyone could provide... i've been trying to find some of this out for close to a month, and i can't find anything anywhere! Thank you! very much for any help!!!