Date Search in PHP

weklica
weklica used Ask the Experts™
on
I have the following php code.  I have figured out how to search via name or other string, but I cannot get this thing to query via date range.  I have the drop downs that don't yet do anything.  I have tried several things for many hours to no avail.  Can anybody help me with this?  I want to select the Day Month Year dropdowns and have it return results from the specified date.

Also attached is an image of how the date and time is setup.  It is a simple time stamp in MySQL.  Although, I could change this format if it is helpful.

Also, I have the search box searching for a last name field.  I MUST be exact.  How do I get this to not be exact.  If I type 'SMITH' it will yield SMITH last name folks.  If I type in, ITH, it will not.  I would like it to return anybody whose last name containts an ITH.  Thoughts on the remaining issues I am having?  

Thanks in advance.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style type="text/css">
   table{
       border:1px solid #000000;
       border-spacing: 0px;
   }
   
   table a, table, tbody, tfoot, tr, th, td{
       font-family: Arial, Helvetica, sans-serif;
   }
   
   table caption{
       font-size: 1.8em;
       text-indent: 100px;
       background: url(bg_caption.gif) left top;
       height: 40px;
       color: #FFFFFF;
       border:1px solid #000000;
   }
   
   thead th{
       background: url(bg_th.gif) left;
       height: 21px;
       color: #FFFFFF;
       font-size: 0.8em;
       font-family: Arial;
       font-weight: bold;
       padding: 0px 7px;
       margin: 20px 0px 0px;
       text-align: left;
   }
   
   tbody tr{
       background: #ffffff;
   }
   
   tbody tr.odd{
       background: #f0f0f0;
   }
   
   tbody th{
       background: url(arrow_white.gif) left center no-repeat;
       background-position: 5px;
       padding-left: 10px !important if Icon desired;
   }
   
   tbody tr.odd th{
       background: url(arrow_grey.gif) left center no-repeat;
       background-position: 5px;
       padding-left: 10px !important if Icon desired;
   }
   
   tbody th, tbody td{
       font-size: 0.8em;
       line-height: 1.4em;
       font-family: Arial, Helvetica, sans-serif;
       color: #000000;
       padding: 10px 7px;
       border-bottom: 1px solid #800000;
       text-align: left;
   }
   
   tbody a{
       color: #000000;
       font-weight: bold;
       text-decoration: none;
   }
   
   tbody a:hover{
       color: #ffffff;
       text-decoration: underline;
   }
   
   tbody tr:hover th{
       background: #800000 url(arrow_red.gif) left center no-repeat;
       background-position: 5px;
       color: #ffffff;
   }
   
   tbody tr.odd:hover th{
       background: #000000 url(arrow_black.gif) left center no-repeat;
       background-position: 5px;
       color: #ffffff;
   }
   
   tbody tr:hover th a, tr.odd:hover th a{
       color: #ffffff;
   }
   
   tbody tr:hover td, tr:hover td a, tr.odd:hover td, tr.odd:hover td a{
       background: #800000;
       color: #ffffff;
   }
   
   tbody tr.odd:hover td, tr.odd:hover td a{
       background: #000000;
       color: #ffffff;
   }
   
   tfoot th, tfoot td{
       background: #ffffff url(bg_footer.gif) repeat-x bottom;
       font-size: 0.8em;
       color: #ffffff;
       height: 21px;
   }
  </style> 
 </head>
<body>
<div align="center">
  <p>
  <?php

$timezone = new DateTimeZone( "MST" ); 
$date = new DateTime(); 
$date->setTimezone( $timezone ); 
echo $date->format('H:i:s A  /  D, M jS, Y' );  

	if ($_POST['choose_or_parse'] == "")
	{
		print '
			<form action="test5.php" method="post">
				
    <input type="hidden" name="choose_or_parse" value="parse" />
    <select name="startyearbox">
      <option value="2010">2010</option>
      <option value="2005">2005</option>
      <option value="2006">2006</option>
      <option value="2007">2007</option>
      <option value="2008">2008</option>
      <option value="2009">2009</option>
    </select>
    <select name="startmonthbox">
      <option value="00">Month</option>
      <option value="01">January</option>
      <option value="02">February</option>
      <option value="03">March</option>
      <option value="04">April</option>
      <option value="05">May</option>
      <option value="06">June</option>
      <option value="07">July</option>
      <option value="08">August</option>
      <option value="09">September</option>
      <option value="10">October</option>
      <option value="11">November</option>
      <option value="12">December</option>
    </select>
    <select name="startdaybox">
      <option value="00">Day</option>
      <option value="01">1</option>
      <option value="02">2</option>
      <option value="03">3</option>
      <option value="04">4</option>
      <option value="05">5</option>
      <option value="06">6</option>
      <option value="07">7</option>
      <option value="08">8</option>
      <option value="09">9</option>
      <option value="10">10</option>
      <option value="11">11</option>
      <option value="12">12</option>
      <option value="13">13</option>
      <option value="14">14</option>
      <option value="15">15</option>
      <option value="16">16</option>
      <option value="17">17</option>
      <option value="18">18</option>
      <option value="19">19</option>
      <option value="20">20</option>
      <option value="21">21</option>
      <option value="22">22</option>
      <option value="23">23</option>
      <option value="24">24</option>
      <option value="25">25</option>
      <option value="26">26</option>
      <option value="27">27</option>
      <option value="28">28</option>
      <option value="29">29</option>
      <option value="30">30</option>
      <option value="31">31</option>
    </select>
    <input type="TEXT" name="LASTNM">
    <input type="SUBMIT" name="submit" value="Get Data">
			</form>';
	}
	
$DayOfMONTH = $_POST['startdaybox'];	
$MonthOfYear = $_POST['startmonthbox'];	
$YearOfCentury = $_POST['startyearbox'];	
$LASTNAMESEARCH = $_POST['LASTNM'];
$username="root";
$password="pwrd";
$database="DatabaseNM";
$DATERANGE = $_POST['startdaybox || startmonthbox || startyearbox'];
$YESTERDAY = mktime(0, 0, 0, date("m")  , date("d")-1, date("Y"));

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
//$query="SELECT * FROM Demographics";
$query="SELECT * FROM Demographics WHERE Test1 = '$LASTNAMESEARCH' ";
//$result=mysql_query($query);
$result=mysql_query($query);

$num=mysql_numrows($result);

mysql_close();
?>
</div>
<div align="center">
  <table border="1">
    <caption><div align="center">Title at the top of the page</caption>
    <thead>
      <tr>
        <td><div align="center"><strong>Date</strong></div></td>
        <td>
          <strong>
          <div align="center">
        UID</td>
        <td>
          <strong>
          <div align="center">
        Last</td>
        <td>
          <strong>
          <div align="center">
        First</td>
        <td>
          <strong>
          <div align="center">
        DOB</td>
        <td>
          <strong>
          <div align="center">
        UID</td>
        <td>
          <strong>
          <div align="center">
        Last</td>
        <td>
          <strong>
          <div align="center">
        First</td>
        <td>
          <strong>
          <div align="center">
        DOB</td>
        <td>
          <strong>
          <div align="center">
        UID</td>
        <td>
          <strong>
          <div align="center">
        Last</td>
        <td>
          <strong>
          <div align="center">
        First</td>
        <td>
          <strong>
          <div align="center">
        DOB</td>       
      </tr>
    </thead>
    <tbody>
      
  <?php
$odd = false;
$i=0;
while ($i < $num) {

$f5=mysql_result($result,$i,"DateSTAMPER");
$f1=mysql_result($result,$i,"UID");
$f2=mysql_result($result,$i,"Test1");
$f3=mysql_result($result,$i,"Test2");
$f4=mysql_result($result,$i,"Test3");
$f11=mysql_result($result,$i,"UID");
$f21=mysql_result($result,$i,"Test1");
$f31=mysql_result($result,$i,"Test2");
$f41=mysql_result($result,$i,"Test3");
$f12=mysql_result($result,$i,"UID");
$f22=mysql_result($result,$i,"Test1");
$f32=mysql_result($result,$i,"Test2");
$f42=mysql_result($result,$i,"Test3");
if($odd){
    $class = ' class="odd"';
}else{
    $class = '';
}
?>
      <tr<?php echo $class; ?>>
        <th><div align="center"><?php echo $f5; ?></th>
        <td><div align="center"><?php echo $f1; ?></td>
        <td><div align="center"><?php echo $f2; ?></td>
        <td><div align="center"><?php echo $f3; ?></td>
        <td><div align="center"><?php echo $f4; ?></td>
        <td><div align="center"><?php echo $f11; ?></td>
        <td><div align="center"><?php echo $f21; ?></td>
        <td><div align="center"><?php echo $f31; ?></td>
        <td><div align="center"><?php echo $f41; ?></td>
        <td><div align="center"><?php echo $f12; ?></td>
        <td><div align="center"><?php echo $f22; ?></td>
        <td><div align="center"><?php echo $f32; ?></td>
        <td><div align="center"><?php echo $f42; ?></td>
        <td><div align="center"><?php echo $YearOfCentury . '-' . $MonthOfYear . '-' . $DayOfMONTH; ?></td>
        <td><div align="center"><?php echo $YESTERDAY; ?></td>
      </tr>
  <?php
$odd = !$odd;
$i++;
}
?>
    </tbody>
  </table>
</div>
<div align="center"></div>
</body>
</html>

Open in new window

Screen-shot-2010-01-31-at-4.54.1.png
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
first of all the name search would be
$query="SELECT * FROM Demographics WHERE Test1LIKE '%$LASTNAMESEARCH%' ";
try
$query="SELECT * FROM Demographics WHERE Test1LIKE '%$LASTNAMESEARCH%' and mydate > '$DATERANGE'";

if I got it all, you are searching for data FROM the given date ?

Author

Commented:
First part works like a charm.  I tried everything, but surrounding the Lastnamesearch with '%'.

The second idea is a bit off, but didn't work regardless.  I think my dates and the $DATERANGE is off too.  

So, the searching for name is awesome, but dates are still not functional via search.  Also, I am just wanting to put in a given date via the drop downs and have the results for that given date only.  not a range from before or after it necessarily.  The exact date would be great.  Thanks!

Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

how about
$query="SELECT * FROM Demographics WHERE Test1LIKE '%$LASTNAMESEARCH%' and MYDATEFIELD LIKE '$DATERANGE%'";
Most Valuable Expert 2011
Top Expert 2016

Commented:
When you want to process dates in PHP and MySQL it is useful to define the MySQL columns with data type DATETIME.  Then in PHP you use the ISO8601-format date which is date('c').  This will give you a column that is easy to read, sort and modify with phpMyAdmin, and it will give you internal data representations that are easy to compute with.

Parsing dates by hand is a fairly common "newbie" programming error.  It is always preferable to use strtotime() to convert date strings to Unix timestamps and to use date() to convert the timestamps to human-readable dates.  There are several reasons for this, but the best reason is that date() and strtotime() play together in ways that are almost magical.

This article may be helpful to the understanding:
http://www.experts-exchange.com/articles/Web_Development/Web_Languages-Standards/PHP/Handling-date-and-time-in-PHP-and-MySQL.html

I will post an example of how to perform a drop-down date selection in a moment.  Best regards, ~Ray
Most Valuable Expert 2011
Top Expert 2016
Commented:
Here is a way to handle the date via a set of drop-down select fields.

In my programming I prefer to just let people type the date into a text box.  The PHP function strtotime() is sufficiently powerful to interpret most English-language human-readable date/time strings into a timestamp.  You can test strtotime on my web site here:
http://www.laprbass.com/RAY_strtotime.php

Best of luck with your project, ~Ray
<?php // RAY_dropdown_date.php
error_reporting(E_ALL);

// SHOW HOW TO HANDLE A DROP-DOWN DATE USING PHP FUNCTIONS strtotime() and date()

// SET UP SOME DEFAULT VALUES TO PROTECT AGAINST MISSING ARGUMENTS
$y = date('Y');
$m = date('m');
$d = date('d');

//IF ANYTHING WAS IN THE URL GET STRING, PROCESS IT
if (!empty($_GET))
{
    // EXTRACT THE DATA FROM THE GET STRING
    if (!empty($_GET["y"])) $y = $_GET["y"];
    if (!empty($_GET["m"])) $m = $_GET["m"];
    if (!empty($_GET["d"])) $d = $_GET["d"];

    // CONVERT THE INFORMATION TO A TIMESTAMP AND TEST FOR ACCEPTABLITY
    if (!$ts = strtotime($y . '-' . $m . '-' . $d))
    {
        echo "<br/>THE DATE IS BOGUS IF YEAR=$y AND MONTH=$m AND DAY=$d\n";
    }
    // TEST FOR AN ERROR IN THE MONTH - CAUSED BY ERROR LIKE FEBRUARY 30
    elseif(date('m', $ts) != $m)
    {
        echo "<br/>THE DATE IS BOGUS IF YEAR=$y AND MONTH=$m AND DAY=$d\n";
    }
    else
    {
        echo "<br/>THE DATE IS VALID IF " . date('r', $ts) . "\n";;
    }
}
// END OF PHP DATE PROCESSING - PUT UP THE FORM
?>



<form>

<select name="y"><option value="?">YEAR</option><?php // GENERATE 5 YEARS
$now = date('Y' . '01-01');
$old = date('Y', strtotime("Now - 5 years"));
while ($old <= $now)
{
    echo "<option value=\"$old\">$old</option>\n";
    $old = date('Y', strtotime($old . "-01-01 + 1 year"));
}
?></select>

<select name="m"><option value="?">MONTH</option><?php // GENERATE 12 MONTHS
$first_month = "2001-01-01";
$last_month  = "2001-12-01";
while ($first_month <= $last_month)
{
    $txt = date('F', strtotime($first_month));
    $mon = date('m', strtotime($first_month));
    echo "<option value=\"$mon\">$txt</option>\n";
    $first_month = date('Y-m-d', strtotime($first_month . " + 1 month"));
}
?></select>

<select name="d"><option value="?">DAY</option><?php // GENERATE 31 DAYS
$first_day = "2001-01-01";
$last_day  = "2001-01-31";
while ($first_day <= $last_day)
{
    $txt = date('jS', strtotime($first_day));
    $day = date('d',  strtotime($first_day));
    echo "<option value=\"$day\">$txt</option>\n";
    $first_day = date('Y-m-d', strtotime($first_day . " + 1 day"));
}
?></select>

<input type="submit" />

</form>

Open in new window

Author

Commented:
Ray,

What you provided was great.  However, I am still just having a crazy hard time getting the drop downs to pull the data I want them to pull from my Database.  Attached is the new version of the php.  Some of it is fluff, some is commented out ,etc/  

is there some way whereby I could select those dropdowns and have it return the lines whose date matches what I selected?  I know I can type in a name or some other free text and have non-date fields respond accordingly, but I cannot seem to get the date portion to respond as desired.  THoughts?  Many thanks  in  advance!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
 <script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
var params = {};
params.scale = "noscale";
params.salign = "tl";
params.wmode = "transparent";
var attributes = {};
swfobject.embedSWF("textmenu.swf", "TextMenuDiv", "600", "153", "9.0.0", false, flashvars, params, attributes);
</script>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style type="text/css">
   table{
       border:1px solid #000000;
       border-spacing: 0px;
   }
   
   table a, table, tbody, tfoot, tr, th, td{
       font-family: Arial, Helvetica, sans-serif;
   }
   
   table caption{
       font-size: 1.8em;
       text-indent: 100px;
       background: url(bg_caption.gif) left top;
       height: 40px;
       color: #FFFFFF;
       border:1px solid #000000;
   }
   
   thead th{
       background: url(bg_th.gif) left;
       height: 21px;
       color: #FFFFFF;
       font-size: 0.8em;
       font-family: Arial;
       font-weight: bold;
       padding: 0px 7px;
       margin: 20px 0px 0px;
       text-align: left;
   }
   
   tbody tr{
       background: #ffffff;
   }
   
   tbody tr.odd{
       background: #f0f0f0;
   }
   
   tbody th{
       background: url(arrow_white.gif) left center no-repeat;
       background-position: 5px;
       padding-left: 10px !important if Icon desired;
   }
   
   tbody tr.odd th{
       background: url(arrow_grey.gif) left center no-repeat;
       background-position: 5px;
       padding-left: 10px !important if Icon desired;
   }
   
   tbody th, tbody td{
       font-size: 0.8em;
       line-height: 1.4em;
       font-family: Arial, Helvetica, sans-serif;
       color: #000000;
       padding: 10px 7px;
       border-bottom: 1px solid #800000;
       text-align: left;
   }
   
   tbody a{
       color: #000000;
       font-weight: bold;
       text-decoration: none;
   }
   
   tbody a:hover{
       color: #ffffff;
       text-decoration: underline;
   }
   
   tbody tr:hover th{
       background: #800000 url(arrow_red.gif) left center no-repeat;
       background-position: 5px;
       color: #ffffff;
   }
   
   tbody tr.odd:hover th{
       background: #000000 url(arrow_black.gif) left center no-repeat;
       background-position: 5px;
       color: #ffffff;
   }
   
   tbody tr:hover th a, tr.odd:hover th a{
       color: #ffffff;
   }
   
   tbody tr:hover td, tr:hover td a, tr.odd:hover td, tr.odd:hover td a{
       background: #800000;
       color: #ffffff;
   }
   
   tbody tr.odd:hover td, tr.odd:hover td a{
       background: #000000;
       color: #ffffff;
   }
   
   tfoot th, tfoot td{
       background: #ffffff url(bg_footer.gif) repeat-x bottom;
       font-size: 0.8em;
       color: #ffffff;
       height: 21px;
   }
  </style>
 </head>
<body>
  <div id="TextMenuDiv"></div>
<div align="center">
  <p>
 
<?php // RAY_dropdown_date.php
error_reporting(E_ALL);

// SHOW HOW TO HANDLE A DROP-DOWN DATE USING PHP FUNCTIONS strtotime() and date()

// SET UP SOME DEFAULT VALUES TO PROTECT AGAINST MISSING ARGUMENTS
$y = date('Y');
$m = date('m');
$d = date('d');

//IF ANYTHING WAS IN THE URL GET STRING, PROCESS IT
if (!empty($_GET))
{
    // EXTRACT THE DATA FROM THE GET STRING
    if (!empty($_GET["y"])) $y = $_GET["y"];
    if (!empty($_GET["m"])) $m = $_GET["m"];
    if (!empty($_GET["d"])) $d = $_GET["d"];

    // CONVERT THE INFORMATION TO A TIMESTAMP AND TEST FOR ACCEPTABLITY
    if (!$ts = strtotime($y . '-' . $m . '-' . $d))
    {
        echo "<br/>!HONK!YEAR=$y AND MONTH=$m AND DAY=$d\n !HONK!";
    }
    // TEST FOR AN ERROR IN THE MONTH - CAUSED BY ERROR LIKE FEBRUARY 30
    elseif(date('m', $ts) != $m)
    {
        echo "<br/>THE DATE IS BOGUS IF YEAR=$y AND MONTH=$m AND DAY=$d\n";
    }
    else
    {
        echo "<br/><br/>DATE SELECTED: " . date('r', $ts) . "\n";;
    }
}
// END OF PHP DATE PROCESSING - PUT UP THE FORM
?>
<?php
$timezone = new DateTimeZone( "MST" );
$date = new DateTime();
$date->setTimezone( $timezone );
//echo $date->format('H:i:s A  /  D, M jS, Y' );
       echo "<br/>CURRENT DATE & TIME: " . date('r') .  "\n";
?>
                  <form action="test8.php" method="post">

<select name="y"><option value="?">YEAR</option><?php // GENERATE 5 YEARS
$now = date('Y' . '01-01');
$old = date('Y', strtotime("Now - 5 years"));
while ($old <= $now)
{
    echo "<option value=\"$old\">$old</option>\n";
    $old = date('Y', strtotime($old . "-01-01 + 1 year"));
}
?></select>

<select name="m"><option value="?">MONTH</option><?php // GENERATE 12 MONTHS
$first_month = "2001-01-01";
$last_month  = "2001-12-01";
while ($first_month <= $last_month)
{
    $txt = date('F', strtotime($first_month));
    $mon = date('m', strtotime($first_month));
    echo "<option value=\"$mon\">$txt</option>\n";
    $first_month = date('Y-m-d', strtotime($first_month . " + 1 month"));
}
?></select>

<select name="d"><option value="?">DAY</option><?php // GENERATE 31 DAYS
$first_day = "2001-01-01";
$last_day  = "2001-01-31";
while ($first_day <= $last_day)
{
    $txt = date('jS', strtotime($first_day));
    $day = date('d',  strtotime($first_day));
    echo "<option value=\"$day\">$txt</option>\n";
    $first_day = date('Y-m-d', strtotime($first_day . " + 1 day"));
}
?></select>

<input type="SUBMIT" name="submit" value="Search Date / Refresh Page">
 
 
 <?php  

      if ($_POST['choose_or_parse'] == "")
      {
            print '
                        
    <input type="hidden" name="choose_or_parse" value="parse" />
    <input type="TEXT" name="LASTNM">
    <input type="SUBMIT" name="submit" value="Query LAST NAME">
                  </form>';
      }
      
$LASTNAMESEARCH = $_POST['LASTNM'];
$username="root";
$password="pword";
$database="ReceiveMIRTH";
$YEARCRITERIA = $_POST['y'];
$MONTHCRITERIA = $_POST['m'];
$DAYCRITERIA = $_POST['d'];

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
//$query="SELECT * FROM Demographics";
//$result=mysql_query($query);

$query="SELECT * FROM Demographics WHERE Test1 LIKE '%$LASTNAMESEARCH%' ";
$result=mysql_query($query);

//echo date('r', $ts);

//$query="SELECT * FROM Demographics WHERE UID > '$LASTNAMESEARCH' ";
//$result=mysql_query($query);

//$query="SELECT * FROM Demographics WHERE DateSTAMPER IS NOT NULL ";
//$result=mysql_query($query);
//echo '<tr><td>' . date("m-d-Y",$receivedate)

$num=mysql_numrows($result);

mysql_close();
?>
</div>
<div align="center">
  <table border="1">
    <caption><div align="center">Title at the top of the page</caption>
    <thead>
      <tr>
        <td><div align="center"><strong>Date</strong></div></td>
        <td>
          <strong>
          <div align="center">
        UID</td>
        <td>
          <strong>
          <div align="center">
        Last</td>
        <td>
          <strong>
          <div align="center">
        First</td>
        <td>
          <strong>
          <div align="center">
        DOB</td>
        <td>
          <strong>
          <div align="center">
        UID</td>
        <td>
          <strong>
          <div align="center">
        Last</td>
        <td>
          <strong>
          <div align="center">
        First</td>
        <td>
          <strong>
          <div align="center">
        DOB</td>
        <td>
          <strong>
          <div align="center">
        UID</td>
        <td>
          <strong>
          <div align="center">
        Last</td>
        <td>
          <strong>
          <div align="center">
        First</td>
        <td>
          <strong>
          <div align="center">
        DOB</td>      
      </tr>
    </thead>
    <tbody>
     
  <?php
$odd = false;
$i=0;
while ($i < $num) {

$f5=mysql_result($result,$i,"DateSTAMPER");
$f1=mysql_result($result,$i,"UID");
$f2=mysql_result($result,$i,"Test1");
$f3=mysql_result($result,$i,"Test2");
$f4=mysql_result($result,$i,"Test3");
$f11=mysql_result($result,$i,"UID");
$f21=mysql_result($result,$i,"Test1");
$f31=mysql_result($result,$i,"Test2");
$f41=mysql_result($result,$i,"Test3");
$f12=mysql_result($result,$i,"UID");
$f22=mysql_result($result,$i,"Test1");
$f32=mysql_result($result,$i,"Test2");
$f42=mysql_result($result,$i,"Test3");
if($odd){
    $class = ' class="odd"';
}else{
    $class = '';
}
?>
      <tr<?php echo $class; ?>>
        <th><div align="center"><?php echo $f5; ?></th>
        <td><div align="center"><?php echo $f1; ?></td>
        <td><div align="center"><?php echo $f2; ?></td>
        <td><div align="center"><?php echo $f3; ?></td>
        <td><div align="center"><?php echo $f4; ?></td>
        <td><div align="center"><?php echo $f11; ?></td>
        <td><div align="center"><?php echo $f21; ?></td>
        <td><div align="center"><?php echo $f31; ?></td>
        <td><div align="center"><?php echo $f41; ?></td>
        <td><div align="center"><?php echo $f12; ?></td>
        <td><div align="center"><?php echo $f22; ?></td>
        <td><div align="center"><?php echo $f32; ?></td>
        <td><div align="center"><?php echo $f42; ?></td>
      </tr>
  <?php
$odd = !$odd;
$i++;
}
?>
    </tbody>
  </table>
</div>
<div align="center"></div>
</body>
</html>
Most Valuable Expert 2011
Top Expert 2016

Commented:
Hi, weklica: When you post code here at EE, please post int he "code" snippet.  It gives us line numbers and makes it feasible to select, copy and paste.
Most Valuable Expert 2011
Top Expert 2016

Commented:
Show us your "create table" statement so we can see what the date field definitions look like, thanks.

Author

Commented:
Yes, my bad on the code snippet.  I hit submit, then realized.  I have now attached it and immediately follow that attachment will be the database I am working with.  Keep in mind, this database is very temporary.  I built it up as a testing DB just to get this up and running.  I just need to see how it all connects, then I will make it work on my official version.  However, what I attach now will be what I am using for the code I will attach immediately below:  Thanks much!  I have wrestled this thing now for a couple of days.  Not sure why this date thing is nailing me like it is?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
 <script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
var params = {};
params.scale = "noscale";
params.salign = "tl";
params.wmode = "transparent";
var attributes = {};
swfobject.embedSWF("textmenu.swf", "TextMenuDiv", "600", "153", "9.0.0", false, flashvars, params, attributes);
</script>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style type="text/css">
   table{
       border:1px solid #000000;
       border-spacing: 0px;
   }
   
   table a, table, tbody, tfoot, tr, th, td{
       font-family: Arial, Helvetica, sans-serif;
   }
   
   table caption{
       font-size: 1.8em;
       text-indent: 100px;
       background: url(bg_caption.gif) left top;
       height: 40px;
       color: #FFFFFF;
       border:1px solid #000000;
   }
   
   thead th{
       background: url(bg_th.gif) left;
       height: 21px;
       color: #FFFFFF;
       font-size: 0.8em;
       font-family: Arial;
       font-weight: bold;
       padding: 0px 7px;
       margin: 20px 0px 0px;
       text-align: left;
   }
   
   tbody tr{
       background: #ffffff;
   }
   
   tbody tr.odd{
       background: #f0f0f0;
   }
   
   tbody th{
       background: url(arrow_white.gif) left center no-repeat;
       background-position: 5px;
       padding-left: 10px !important if Icon desired;
   }
   
   tbody tr.odd th{
       background: url(arrow_grey.gif) left center no-repeat;
       background-position: 5px;
       padding-left: 10px !important if Icon desired;
   }
   
   tbody th, tbody td{
       font-size: 0.8em;
       line-height: 1.4em;
       font-family: Arial, Helvetica, sans-serif;
       color: #000000;
       padding: 10px 7px;
       border-bottom: 1px solid #800000;
       text-align: left;
   }
   
   tbody a{
       color: #000000;
       font-weight: bold;
       text-decoration: none;
   }
   
   tbody a:hover{
       color: #ffffff;
       text-decoration: underline;
   }
   
   tbody tr:hover th{
       background: #800000 url(arrow_red.gif) left center no-repeat;
       background-position: 5px;
       color: #ffffff;
   }
   
   tbody tr.odd:hover th{
       background: #000000 url(arrow_black.gif) left center no-repeat;
       background-position: 5px;
       color: #ffffff;
   }
   
   tbody tr:hover th a, tr.odd:hover th a{
       color: #ffffff;
   }
   
   tbody tr:hover td, tr:hover td a, tr.odd:hover td, tr.odd:hover td a{
       background: #800000;
       color: #ffffff;
   }
   
   tbody tr.odd:hover td, tr.odd:hover td a{
       background: #000000;
       color: #ffffff;
   }
   
   tfoot th, tfoot td{
       background: #ffffff url(bg_footer.gif) repeat-x bottom;
       font-size: 0.8em;
       color: #ffffff;
       height: 21px;
   }
  </style> 
 </head>
<body>
  <div id="TextMenuDiv"></div>
<div align="center">
  <p>
  
<?php // RAY_dropdown_date.php
error_reporting(E_ALL);

// SHOW HOW TO HANDLE A DROP-DOWN DATE USING PHP FUNCTIONS strtotime() and date()

// SET UP SOME DEFAULT VALUES TO PROTECT AGAINST MISSING ARGUMENTS
$y = date('Y');
$m = date('m');
$d = date('d');

//IF ANYTHING WAS IN THE URL GET STRING, PROCESS IT
if (!empty($_GET))
{
    // EXTRACT THE DATA FROM THE GET STRING
    if (!empty($_GET["y"])) $y = $_GET["y"];
    if (!empty($_GET["m"])) $m = $_GET["m"];
    if (!empty($_GET["d"])) $d = $_GET["d"];

    // CONVERT THE INFORMATION TO A TIMESTAMP AND TEST FOR ACCEPTABLITY
    if (!$ts = strtotime($y . '-' . $m . '-' . $d))
    {
        echo "<br/>!HONK!YEAR=$y AND MONTH=$m AND DAY=$d\n !HONK!";
    }
    // TEST FOR AN ERROR IN THE MONTH - CAUSED BY ERROR LIKE FEBRUARY 30
    elseif(date('m', $ts) != $m)
    {
        echo "<br/>THE DATE IS BOGUS IF YEAR=$y AND MONTH=$m AND DAY=$d\n";
    }
    else
    {
        echo "<br/><br/>DATE SELECTED: " . date('r', $ts) . "\n";;
    }
}
// END OF PHP DATE PROCESSING - PUT UP THE FORM
?>
<?php
$timezone = new DateTimeZone( "MST" ); 
$date = new DateTime(); 
$date->setTimezone( $timezone ); 
//echo $date->format('H:i:s A  /  D, M jS, Y' );
       echo "<br/>CURRENT DATE & TIME: " . date('r') .  "\n";
?>
			<form action="test8.php" method="post">

<select name="y"><option value="?">YEAR</option><?php // GENERATE 5 YEARS
$now = date('Y' . '01-01');
$old = date('Y', strtotime("Now - 5 years"));
while ($old <= $now)
{
    echo "<option value=\"$old\">$old</option>\n";
    $old = date('Y', strtotime($old . "-01-01 + 1 year"));
}
?></select>

<select name="m"><option value="?">MONTH</option><?php // GENERATE 12 MONTHS
$first_month = "2001-01-01";
$last_month  = "2001-12-01";
while ($first_month <= $last_month)
{
    $txt = date('F', strtotime($first_month));
    $mon = date('m', strtotime($first_month));
    echo "<option value=\"$mon\">$txt</option>\n";
    $first_month = date('Y-m-d', strtotime($first_month . " + 1 month"));
}
?></select>

<select name="d"><option value="?">DAY</option><?php // GENERATE 31 DAYS
$first_day = "2001-01-01";
$last_day  = "2001-01-31";
while ($first_day <= $last_day)
{
    $txt = date('jS', strtotime($first_day));
    $day = date('d',  strtotime($first_day));
    echo "<option value=\"$day\">$txt</option>\n";
    $first_day = date('Y-m-d', strtotime($first_day . " + 1 day"));
}
?></select>

<input type="SUBMIT" name="submit" value="Search Date / Refresh Page">
  
  
 <?php  

	if ($_POST['choose_or_parse'] == "")
	{
		print '
				
    <input type="hidden" name="choose_or_parse" value="parse" />
    <input type="TEXT" name="LASTNM">
    <input type="SUBMIT" name="submit" value="Query LAST NAME">
			</form>';
	}
	
$LASTNAMESEARCH = $_POST['LASTNM'];
$username="root";
$password="pwrd";
$database="ReceiveMIRTH";
$YEARCRITERIA = $_POST['y'];
$MONTHCRITERIA = $_POST['m'];
$DAYCRITERIA = $_POST['d'];

mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
//$query="SELECT * FROM Demographics";
//$result=mysql_query($query);

$query="SELECT * FROM Demographics WHERE Test1 LIKE '%$LASTNAMESEARCH%' ";
$result=mysql_query($query);

//echo date('r', $ts);

//$query="SELECT * FROM Demographics WHERE UID > '$LASTNAMESEARCH' ";
//$result=mysql_query($query);

//$query="SELECT * FROM Demographics WHERE DateSTAMPER IS NOT NULL ";
//$result=mysql_query($query);
//echo '<tr><td>' . date("m-d-Y",$receivedate)

$num=mysql_numrows($result);

mysql_close();
?>
</div>
<div align="center">
  <table border="1">
    <caption><div align="center">Title at top of table</caption>
    <thead>
      <tr>
        <td><div align="center"><strong>Date</strong></div></td>
        <td>
          <strong>
          <div align="center">
        UID</td>
        <td>
          <strong>
          <div align="center">
        Last</td>
        <td>
          <strong>
          <div align="center">
        First</td>
        <td>
          <strong>
          <div align="center">
        DOB</td>
        <td>
          <strong>
          <div align="center">
        UID</td>
        <td>
          <strong>
          <div align="center">
        Last</td>
        <td>
          <strong>
          <div align="center">
        First</td>
        <td>
          <strong>
          <div align="center">
        DOB</td>
        <td>
          <strong>
          <div align="center">
        UID</td>
        <td>
          <strong>
          <div align="center">
        Last</td>
        <td>
          <strong>
          <div align="center">
        First</td>
        <td>
          <strong>
          <div align="center">
        DOB</td>       
      </tr>
    </thead>
    <tbody>
      
  <?php
$odd = false;
$i=0;
while ($i < $num) {

$f5=mysql_result($result,$i,"DateSTAMPER");
$f1=mysql_result($result,$i,"UID");
$f2=mysql_result($result,$i,"Test1");
$f3=mysql_result($result,$i,"Test2");
$f4=mysql_result($result,$i,"Test3");
$f11=mysql_result($result,$i,"UID");
$f21=mysql_result($result,$i,"Test1");
$f31=mysql_result($result,$i,"Test2");
$f41=mysql_result($result,$i,"Test3");
$f12=mysql_result($result,$i,"UID");
$f22=mysql_result($result,$i,"Test1");
$f32=mysql_result($result,$i,"Test2");
$f42=mysql_result($result,$i,"Test3");
if($odd){
    $class = ' class="odd"';
}else{
    $class = '';
}
?>
      <tr<?php echo $class; ?>>
        <th><div align="center"><?php echo $f5; ?></th>
        <td><div align="center"><?php echo $f1; ?></td>
        <td><div align="center"><?php echo $f2; ?></td>
        <td><div align="center"><?php echo $f3; ?></td>
        <td><div align="center"><?php echo $f4; ?></td>
        <td><div align="center"><?php echo $f11; ?></td>
        <td><div align="center"><?php echo $f21; ?></td>
        <td><div align="center"><?php echo $f31; ?></td>
        <td><div align="center"><?php echo $f41; ?></td>
        <td><div align="center"><?php echo $f12; ?></td>
        <td><div align="center"><?php echo $f22; ?></td>
        <td><div align="center"><?php echo $f32; ?></td>
        <td><div align="center"><?php echo $f42; ?></td>
      </tr>
  <?php
$odd = !$odd;
$i++;
}
?>
    </tbody>
  </table>
</div>
<div align="center"></div>
</body>
</html>

Open in new window

Author

Commented:
Here is the SQL that I had PHPMYADMIN crank out...

The DateSTAMPER is auto-generated by MySQL.  I can actually put it in manually if it would help vs having the database doing thetimestamp feature.  I could also change this to datestamp feature if that would be helpful.  Really, anything you think would make this easier to approach ... I am agreeable!  

 
-- phpMyAdmin SQL Dump
-- version 3.3.0-beta1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Feb 01, 2010 at 04:24 PM
-- Server version: 5.1.42
-- PHP Version: 5.2.9

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `ReceiveMIRTH`
--

-- --------------------------------------------------------

--
-- Table structure for table `Demographics`
--

CREATE TABLE IF NOT EXISTS `Demographics` (
  `UID` int(11) NOT NULL AUTO_INCREMENT,
  `Test1` varchar(255) NOT NULL,
  `Test2` varchar(255) NOT NULL,
  `Test3` varchar(255) NOT NULL,
  `DateSTAMPER` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`UID`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=665 ;

--
-- Dumping data for table `Demographics`
--

INSERT INTO `Demographics` (`UID`, `Test1`, `Test2`, `Test3`, `DateSTAMPER`) VALUES
(1, 'LastNameTest', 'FirstNameTest', '19500101', '2010-02-01 10:02:29'),

Open in new window

Author

Commented:
OK.  One more thing here.  I was wanting the date search capability, because I don't want the list to become unmanageable ... and the date is the best way to filter through the items still needing to be looked at.  however, I made some modifications to this thing.  I added a row on the left of the table called Processed.  It contains a button.  What would be most excellent, is that if, when the button is pushed, it actually inserts a '1' into the new database field called 'Processed'.

The way I have it setup right now, is that the field 'Processed' is updated with a one, if AND ONLY IF I type in the exact number of the 'UID' field that I want updated.  Currently, Processed is set to default to 0.  AGAIN, The change to a '1' takes place ONLY if I type in the respective UID number in the second 'free text' box and press query search (as if I were query searching a name).

I know I am way off, but I can't wrap my head around how to get the 'YES' Button on a given row to update that ROWS' Processed entry from a 0 to a 1.  See the new version of the PHP below.  I have also formed a new question on this, but wanted to throw it your way as it would suffice in the event the date search is too complicated.  

this is the string you will now notice that does what I explained above ...

mysql_query("UPDATE `ReceiveMIRTH`.`Demographics` SET `Processed` = '1' WHERE `Demographics`.`UID` = $UID_TAG;");

What I CANNOT get to update its respective row is this:
         <th><div align="center"><input name=completeBUTTON type="button" value="Yes"><br/></th>

I am sure it is because the Form was already opened and closed.  not sure how to get this involved with the open form.  My understanding is that I cannot have multiple forms on the page??


Many Thanks for your assistance thus far!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
 <head>
 <script type="text/javascript" src="swfobject.js"></script>
<script type="text/javascript">
var flashvars = {};
var params = {};
params.scale = "noscale";
params.salign = "tl";
params.wmode = "transparent";
var attributes = {};
swfobject.embedSWF("textmenu.swf", "TextMenuDiv", "600", "153", "9.0.0", false, flashvars, params, attributes);
</script>
  <title></title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <style type="text/css">
   table{
       border:1px solid #000000;
       border-spacing: 0px;
   }
   
   table a, table, tbody, tfoot, tr, th, td{
       font-family: Arial, Helvetica, sans-serif;
   }
   
   table caption{
       font-size: 1.8em;
       text-indent: 100px;
       background: url(bg_caption.gif) left top;
       height: 40px;
       color: #FFFFFF;
       border:1px solid #000000;
   }
   
   thead th{
       background: url(bg_th.gif) left;
       height: 21px;
       color: #FFFFFF;
       font-size: 0.8em;
       font-family: Arial;
       font-weight: bold;
       padding: 0px 7px;
       margin: 20px 0px 0px;
       text-align: left;
   }
   
   tbody tr{
       background: #ffffff;
   }
   
   tbody tr.odd{
       background: #f0f0f0;
   }
   
   tbody th{
       background: url(arrow_white.gif) left center no-repeat;
       background-position: 5px;
       padding-left: 10px !important if Icon desired;
   }
   
   tbody tr.odd th{
       background: url(arrow_grey.gif) left center no-repeat;
       background-position: 5px;
       padding-left: 10px !important if Icon desired;
   }
   
   tbody th, tbody td{
       font-size: 0.8em;
       line-height: 1.4em;
       font-family: Arial, Helvetica, sans-serif;
       color: #000000;
       padding: 10px 7px;
       border-bottom: 1px solid #800000;
       text-align: left;
   }
   
   tbody a{
       color: #000000;
       font-weight: bold;
       text-decoration: none;
   }
   
   tbody a:hover{
       color: #ffffff;
       text-decoration: underline;
   }
   
   tbody tr:hover th{
       background: #800000 url(arrow_red.gif) left center no-repeat;
       background-position: 5px;
       color: #ffffff;
   }
   
   tbody tr.odd:hover th{
       background: #000000 url(arrow_black.gif) left center no-repeat;
       background-position: 5px;
       color: #ffffff;
   }
   
   tbody tr:hover th a, tr.odd:hover th a{
       color: #ffffff;
   }
   
   tbody tr:hover td, tr:hover td a, tr.odd:hover td, tr.odd:hover td a{
       background: #800000;
       color: #ffffff;
   }
   
   tbody tr.odd:hover td, tr.odd:hover td a{
       background: #000000;
       color: #ffffff;
   }
   
   tfoot th, tfoot td{
       background: #ffffff url(bg_footer.gif) repeat-x bottom;
       font-size: 0.8em;
       color: #ffffff;
       height: 21px;
   }
  </style> 
 </head>
<body>
  <div id="TextMenuDiv"></div>
<div align="center">
  <p>
  
<?php // RAY_dropdown_date.php
error_reporting(E_ALL);

// SHOW HOW TO HANDLE A DROP-DOWN DATE USING PHP FUNCTIONS strtotime() and date()

// SET UP SOME DEFAULT VALUES TO PROTECT AGAINST MISSING ARGUMENTS
$y = date('Y');
$m = date('m');
$d = date('d');

//IF ANYTHING WAS IN THE URL GET STRING, PROCESS IT
if (!empty($_GET))
{
    // EXTRACT THE DATA FROM THE GET STRING
    if (!empty($_GET["y"])) $y = $_GET["y"];
    if (!empty($_GET["m"])) $m = $_GET["m"];
    if (!empty($_GET["d"])) $d = $_GET["d"];

    // CONVERT THE INFORMATION TO A TIMESTAMP AND TEST FOR ACCEPTABLITY
    if (!$ts = strtotime($y . '-' . $m . '-' . $d))
    {
        echo "<br/>!HONK!YEAR=$y AND MONTH=$m AND DAY=$d\n !HONK!";
    }
    // TEST FOR AN ERROR IN THE MONTH - CAUSED BY ERROR LIKE FEBRUARY 30
    elseif(date('m', $ts) != $m)
    {
        echo "<br/>THE DATE IS BOGUS IF YEAR=$y AND MONTH=$m AND DAY=$d\n";
    }
    else
    {
        echo "<br/><br/>DATE SELECTED: " . date('r', $ts) . "\n";;
    }
}
// END OF PHP DATE PROCESSING - PUT UP THE FORM
?>
<?php
$timezone = new DateTimeZone( "MST" ); 
$date = new DateTime(); 
$date->setTimezone( $timezone ); 
//echo $date->format('H:i:s A  /  D, M jS, Y' );
       echo "<br/>CURRENT DATE & TIME: " . date('r') .  "\n";
?>
			<form action="test8.php" method="post">

<select name="y"><option value="?">YEAR</option><?php // GENERATE 5 YEARS
$now = date('Y' . '01-01');
$old = date('Y', strtotime("Now - 5 years"));
while ($old <= $now)
{
    echo "<option value=\"$old\">$old</option>\n";
    $old = date('Y', strtotime($old . "-01-01 + 1 year"));
}
?></select>

<select name="m"><option value="?">MONTH</option><?php // GENERATE 12 MONTHS
$first_month = "2001-01-01";
$last_month  = "2001-12-01";
while ($first_month <= $last_month)
{
    $txt = date('F', strtotime($first_month));
    $mon = date('m', strtotime($first_month));
    echo "<option value=\"$mon\">$txt</option>\n";
    $first_month = date('Y-m-d', strtotime($first_month . " + 1 month"));
}
?></select>

<select name="d"><option value="?">DAY</option><?php // GENERATE 31 DAYS
$first_day = "2001-01-01";
$last_day  = "2001-01-31";
while ($first_day <= $last_day)
{
    $txt = date('jS', strtotime($first_day));
    $day = date('d',  strtotime($first_day));
    echo "<option value=\"$day\">$txt</option>\n";
    $first_day = date('Y-m-d', strtotime($first_day . " + 1 day"));
}
?></select>

<input type="SUBMIT" name="submit" value="Search Date / Refresh Page">
  
  
 <?php  

	if ($_POST['choose_or_parse'] == "")
	{
		print '
				
    <input type="hidden" name="choose_or_parse" value="parse" />
    <input type="TEXT" name="LASTNM">
	<input type="TEXT" name="UIDtag">
    <input type="SUBMIT" name="submit" value="Query LAST NAME">
			</form>';
	}
	
$UID_TAG = $_POST['UIDtag'];
$LASTNAMESEARCH = $_POST['LASTNM'];
$username="root";
$password="pwrd";
$database="ReceiveMIRTH";
$YEARCRITERIA = $_POST['y'];
$MONTHCRITERIA = $_POST['m'];
$DAYCRITERIA = $_POST['d'];
$COMPLETEBUTTON = $_POST[completeBUTTON];

mysql_connect(localhost,$username,$password);
$con = mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
//$query="SELECT * FROM Demographics";
//$result=mysql_query($query);

$query="SELECT * FROM Demographics WHERE Test1 LIKE '%$LASTNAMESEARCH%' ";
$result=mysql_query($query);

//echo date('r', $ts);

//$query="SELECT * FROM Demographics WHERE UID > '$LASTNAMESEARCH' ";
//$result=mysql_query($query);

//$query="SELECT * FROM Demographics WHERE DateSTAMPER IS NOT NULL ";
//$result=mysql_query($query);
//echo '<tr><td>' . date("m-d-Y",$receivedate)

mysql_query("UPDATE `ReceiveMIRTH`.`Demographics` SET `Processed` = '1' WHERE `Demographics`.`UID` = $UID_TAG;");

$num=mysql_numrows($result);

mysql_close();
?>
</div>
<div align="center">
  <table border="1">
    <caption><div align="center">Title at the top of the table</caption>
    <thead>
      <tr>
      <td><div align="center"><strong>Processed</strong></div></td>
      <td><div align="center"><strong>Date</strong></div></td>
      <td><div align="center"><strong>UID</strong></div></td>
      <td><div align="center"><strong>Last</strong></div></td>
      <td><div align="center"><strong>First</strong></div></td>
      <td><div align="center"><strong>DOB</strong></div></td>
      <td><div align="center"><strong>UID</strong></div></td>
      <td><div align="center"><strong>Last</strong></div></td>
      <td><div align="center"><strong>First</strong></div></td>
      <td><div align="center"><strong>DOB</strong></div></td>
      <td><div align="center"><strong>UID</strong></div></td>
      <td><div align="center"><strong>Last</strong></div></td>
      <td><div align="center"><strong>First</strong></div></td>
      <td><div align="center"><strong>DOB</strong></div></td> 
      <td><div align="center"><strong>Complete</strong></div></td>   
      </tr>
    </thead>
    <tbody>
      
  <?php
$odd = false;
$i=0;
while ($i < $num) {

$f6=mysql_result($result,$i,"Processed");
$f5=mysql_result($result,$i,"DateSTAMPER");
$f1=mysql_result($result,$i,"UID");
$f2=mysql_result($result,$i,"Test1");
$f3=mysql_result($result,$i,"Test2");
$f4=mysql_result($result,$i,"Test3");
$f11=mysql_result($result,$i,"UID");
$f21=mysql_result($result,$i,"Test1");
$f31=mysql_result($result,$i,"Test2");
$f41=mysql_result($result,$i,"Test3");
$f12=mysql_result($result,$i,"UID");
$f22=mysql_result($result,$i,"Test1");
$f32=mysql_result($result,$i,"Test2");
$f42=mysql_result($result,$i,"Test3");
if($odd){
    $class = ' class="odd"';
}else{
    $class = '';
}
?>
      <tr<?php echo $class; ?>>
        <th><div align="center"><input name=completeBUTTON type="button" value="Yes"><br/></th>
		<th><div align="center"><?php echo $f5; ?></th>
        <td><div align="center"><?php echo $f1; ?></td>
        <td><div align="center"><?php echo $f2; ?></td>
        <td><div align="center"><?php echo $f3; ?></td>
        <td><div align="center"><?php echo $f4; ?></td>
        <td><div align="center"><?php echo $f11; ?></td>
        <td><div align="center"><?php echo $f21; ?></td>
        <td><div align="center"><?php echo $f31; ?></td>
        <td><div align="center"><?php echo $f41; ?></td>
        <td><div align="center"><?php echo $f12; ?></td>
        <td><div align="center"><?php echo $f22; ?></td>
        <td><div align="center"><?php echo $f32; ?></td>
        <td><div align="center"><?php echo $f42; ?></td>
        <td><div align="center"><?php echo $f6; ?></td>
      </tr>
  <?php
$odd = !$odd;
$i++;
}
?>
    </tbody>
  </table>
</div>
<div align="center"></div>
</body>
</html>

Open in new window

Most Valuable Expert 2011
Top Expert 2016

Commented:
Wow, this is so much code that you might want to hire a developer to help with this - it does not seem like a question anyone could answer without extensive research into what you have already written.  

I can help with this part:

"My understanding is that I cannot have multiple forms on the page??"

You can have as many forms on a page as you want.  Do not nest the opening and closing tags in any way - each form must be "atomic" for predictable behavior.  When a submit button is fired it will only submit the form that it is inside of.  You can see the contents of a submitted form by using the var_dump() command and referring to either $_GET or $_POST.

best of luck with it, ~Ray

Author

Commented:
Thanks for the help!  I got it all figured out.
Most Valuable Expert 2011
Top Expert 2016

Commented:
Thanks very much for the points - glad it is all headed in the right direction now! ~Ray

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial