Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
Donovan
Client



Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Sun Jan 23, 2005 6:22 pm Reply with quote

I am slowly working my way thru creating the backend to my MILPACS module. I am currently working on a page to edit the units page which can be seen here. [ Only registered users can see links on this board! Get registered or login! ]

This is the page for 1st Platoon. I have 5 units in my roster_units table and I am trying to find the best way to display the data for each unit.

Forms are not my strong area and I've probably got several issues with this latest editunit.php page.

But it's a start.

I'm trying to loop thru and display the info for all my units and create them in their own table. There are only 9 fields I need to mess with. Trying to get $counter = ($counter + 1) to increment thru my units to display.

I don't even know if this code:

Code:
$unit_count = max("SELECT unit_id FROM roster_units");


would work to find the max number of units in the table.

As alway any help is much appreciated.

-Donovan


Code:
<?php 

//////////////////////////////////////////////////////////////////////
//===========================
// MILPACS
//
// This is the Military Personell and Classification System.
//
//
//
///////////////////////////////////////////////////////////////////////
if (!eregi("modules.php", $PHP_SELF)) {
   die ("You can't access this file directly...");
    }
$index = 0;
//finds the server's root directory
$self = dirname(__FILE__);
$nukemod = basename($self);
$rootdir = eregi_replace("/modules/$nukemod", "", $self);
$index=0;
require_once("mainfile.php");
global $module_name, $db;
$module_name = basename(dirname(__FILE__));
include("header.php");
OpenTable();
echo "<html>";
echo "<body>";
echo "<form name=\"editunit\">";
echo "<form action=\"$_SERVER ['PHP_SELF']\" method=\"POST\">";
echo "<div align=\"center\">";
echo "<H2>3rd ID Unit Page</H2>";   
echo "<HR>";
echo "</div>";
echo "<br>";
$unit_count = max("SELECT unit_id FROM roster_units");
$counter = 0;
while ( $counter <= $unit_count) {
echo "<H3>Unit Information</H3>";
   $sql = "SELECT * FROM roster_units ORDER BY unit_id";
   $result = $db->sql_query($sql);
   while ( $row = $db->sql_fetchrow($result) ) {
   $unit = $row["unit_name"];
   $nick = $row["unit_nick"];
   $creed = $row["unit_creed"];
   $motto = $row["unit_motto"];
   $image = $row["unit_image"];
   $goal1 = $row["unit_goal_one"];
   $goal2 = $row["unit_goal_two"];
   $goal3 = $row["unit_goal_three"];
   $bio = $row["unit_bio"];
   }
echo" <HR>" 
  . "  <table align= center>"
  . "  <tr>         "
  . "   <th align = right>Unit:</td><input type=\"text\" name=\"$unit\" size=\"30\"/>"
  . "  <tr>   "
  . "   <th align = right>Unit Name:</td><input type=\"text\" name=\"$nick\" size=\"25\"/>"
  . "  <tr>   "
  . "   <th align = right>Creed:</td><input type=\"text\" name=\"$creed\" size=\"25\"/>"
  . "  <tr>   "
  . "   <th align = right>Motto:</td><input type=\"text\" name=\"$motto\" size=\"25\"/>"
  . "  <tr>   "
  . "   <th align = right>Unit Image:</td><input type=\"text\" name=\"$image\" size=\"25\"/>"
  . "  <tr>   "
  . "   <th align = right>Goal One:</td><input type=\"text\" name=\"$goal1\" size=\"25\"/>"
  . "  <tr>   "
  . "   <th align = right>Goal Two</td><input type=\"text\" name=\"$goal2\" size=\"20\"/>"
  . "  <tr>   "
  . "   <th align = right>Goal Three:</td><input type=\"text\" name=\"$goal3\" size=\"25\"/>"
  . "  <tr>"
  . "   <th align = right>Unit Bio:</td><input type=\"text\" name=\"$bio\" size=\"25\"/>"
  . "  <tr>"
  . "     <td colspan=2 align=center>"
  . "   <input type=submit value=\"Update Unit\">"
  . "   </table> "
  . "</form>";
  $counter = ($counter + 1)
}
echo "</body>";
echo "</html>";
CloseTable();
include("footer.php");
?>
 
View user's profile Send private message Visit poster's website ICQ Number
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©