Hello again everyone.
I have a module I am developing in PHP for use on PHPNuke sites called MILPACS. What I am trying to do is create a combat record for the soldier profile page. You can see mine here at the bottom
http://www.3rd-infantry-division.net/modules.php?name=MILPACS&file=soldierprofile&uniqueid=6
I manually added those records into the table milpacs_combat for display purposes.
What I want to do is create a combat record management page which I have here. I pull this from my vwar install that keeps track of all my matches.
$sql = "SELECT v.warid, v.status, v.matchtypeid, v.dateline, vo.oppname, vo.oppid FROM vwar v INNER JOIN vwar_opponents vo WHERE v.oppid = vo.oppid AND v.matchtypeid != 3 AND v.status = 1 ORDER BY dateline DESC";

I then have this next page where I list all the soldiers who are on active duty or on leave from the unit and may have participated in the match.

I then want to check each name of the solder who showed up for the match and played, then I click submit and it adds them to the milpacs_combat table. I need to link each check box with each uniqueid of the soldier.
Here is my code for the editwar.php
<?php
/************************************************************************/
/* MILPACS (Military Personell and Classification System) */
/* Author::Donovan [3rd ID] */
/* Copyright (c) 2005 by Steven Donovan AKA Donovan [3rd ID] */
/* Email:: donovan@3rd-infantry-division.net
/* Homepage::http://www.3rd-infantry-division.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/* */
/* This program is distributed in the hope that it will be useful, but */
/* WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
/* General Public License for more details. */
/* */
/* If you want a copy of the GNU General Public License write to the */
/* Free Software Foundation, Inc. */
/* 59 Temple Place, Suite 330, Boston, MA 02111-1307 */
/* USA */
/************************************************************************/
if (stristr($_SERVER['SCRIPT_NAME'], "editwar.php")) {
Header("Location: ../../index.php");
die();
}
if (!in_groups('1-10-23')) {
// Not authorized
echo "<META HTTP-EQUIV=\"refresh\" content=\".1;URL=modules.php?name=MILPACS&file=accessdenied\">";
echo "<a href=\"modules.php?name=MILPACS&file=accessdenied\">";
}
//finds the server's root directory
$index = 0;
@require_once("mainfile.php");
@include_once("header.php");
global $module_name, $db, $prefix;
$warid = $_GET['warid'];
OpenTable();
if ($op == "saveWar") {
// Validations go here
// If all validations passed, save and exit, otherwise, redisplay with errors
if ($warid == 0) {
$sql = "INSERT INTO " . $prefix . "_milpacs_combat (
warid,
uniqueid,
oppid,
) VALUES (
null,
$warid,
$uniqueid,
$oppid,
)";
} else {
$result = $db->sql_query ("UPDATE " . $prefix . "_milpacs_combat set warid = '$warid', uniqueid = '$uniqueid', oppid = '$oppid' WHERE warid = '$warid'");
}
if (!$result) {
echo("<p>Error adding Soldier!" . mysql_error() . "</p>");
}
else {
$result = $db->sql_query($sql);
echo "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=modules.php?name=$module_name&op=editwar&warid=$id\">";
exit();
}
}
$result1 = $db->sql_query("SELECT * FROM vwar v JOIN vwar_opponents vo JOIN vwar_matchtype vmt WHERE v.status = 1 AND v.oppid = vo.oppid AND warid = '$warid'");
if (!$result1) {
echo("<p>Error accessing war data!" . mysql_error() . "</p>");
}
while ($row = $db->sql_fetchrow($result1)) {
$date = date("F j, Y", $row["dateline"]);
$oppname = $row["oppname"];
$matchtype = $row["matchtypename"];
}
?>
<!--// Load members-->
<!--// Need to read the value of warstatus to load the checkboxes with checked or unchecked values. -->
<!--// Soldiers warstatus are either "1" which means they showed up for a match or "NULL" they did not show.-->
<!--// If box is checked then load a "1" into warstatus in the combat table.-->
<form name="editwar" action="modules.php?name=<?php echo $module_name ?>" method="POST">
<div align="center">
<label><H2>3rd ID War Report</H2></label>
<HR>
</div>
<br>
<p>
<strong>War Date: <?php echo $date ?> </strong>
<br>
<strong>Enemy Engaged: <?php echo $oppname ?> </strong>
<br>
<strong>Matchtype: <?php echo $matchtype ?> </strong>
<br>
<table border=0 width='100%' cellpadding='5'><tr>
<table border=0 width='100%' cellpadding='3'><tr><th width='5%'>Rank</th><th width='20%'>Name</th><th width='15%'><b>Position</b></th><th width='10%'>Present</th>
</tr>
</table>
<table border=0 width='100%' cellpadding='5'>
<?php
$sql = "SELECT mm.uniqueid, mm.unit_id, mm.position, mr.rank_abbr, mm.name FROM " . $prefix . "_milpacs_members mm JOIN " . $prefix . "_milpacs_ranks mr WHERE mm.rank_id = mr.rank_id AND mm.unit_id != '' AND mm.status IN ('Active','LOA') ORDER BY mm.rank_id ";
$result = $db->sql_query($sql);
while ( $row = $db->sql_fetchrow($result) ) {
$id = $row["uniqueid"];
$rank = $row["rank_abbr"];
$name = $row["name"];
$position = $row["position"];
?>
<tr>
<td align="center" width="5%"><b><font color="#000000"><?php echo $rank ?></font></b>
</td>
<td align="center" width="20%"><b><font color="#000000"><?php echo $name ?></font></b>
</td>
<td align="center" width="15%"><b><font color="#000000"><?php echo $position ?></font></b>
</td>
<td align="center" width="10%"><input <?php if (!(strcmp($_POST['warstatus'],"Yes"))) {echo "checked";} ?> name="warstatus" type="checkbox" id="warstatus" value="Yes">
</td>
</tr>
<?php
}
?>
</table>
<input type="submit" align="center" name="Submit" value="Save"/>
<input type="hidden" name="op" value="saveWar"/>
<input type="hidden" name="warid" value="<?php echo $warid ?>"/>
</form>
<?php
CloseTable();
?>
The warid and uniqueid are concantenated and end up as the primary key of the combat table. I want to be able to initially add the members to the combat table or update the table to make changes. The editwar page will have to read from the table to see if this person is already listed and checked for this warid.
Any help is appreciated.