View Full Version : Is this possible in PHP

07-02-2007, 07:08 PM
hello everyone,

i have a unique issue to work out and i am wondering if it is possible. what i have is a website that schedules classes. each class is a week. the way the admin area works is i have ways to look at everyone registered for a class by going through a form and choosing the class date i want. i have a filter for people approved to come to a class giving them a 0 for not approved and a 1 for approved in a field. i can sort on that once i am in the specific class date. what i am wanting to do is have a way of denoting which classes have people in it that are not approved so i do not have to go through each class sorting. is there a way to change the color of the text or something to denote this?

what would my php statment look like? would it be an if searching on date and then populating an array of what dates had a not approved in it?

can anyone help me with this? i appreciate your time

07-04-2007, 07:01 AM
I could not come to understand after reading whole post but with the following line:

is there a way to change the color of the text or something to denote this?

Do you mean that you want to distinguish the row that is not approved with some different color?

If you can separate your records which is approved and which is not approved, then you can simply change the background color of the row.

Umm i don't know i understood your problem and replied. Lol

07-04-2007, 02:52 PM
heheh sorry.

ok what my website does is schedule classes that are a week long on health. what i need is a way to denote which week has new people registered that we have not looked at yet. the girls in the office approve each new person coming to a class. they do that by going to a screen that lists all of the classes in a drop down and then sorting those results once they are in there. is there a way for me to make that drop down show which classes actually have new people in them without them having to go to each week and look? in case this helps here is the code i am using for the first screen.


// If search is active
if ($_POST['search']) {
$date = $_POST['date'];
$count = 0;

// Get results from database
$users = mysql_query("SELECT * FROM `form` WHERE Date = '$date' ORDER BY RegID DESC") or die ('Error Getting Users! \n<br />\n' .mysql_error());
$chk = mysql_num_rows($users);

// If no users found
if ($chk < 1) {
echo 'There are no users registered on the date: <b>'.$date.'</b>
<br />
<a href="bih.html">&lt;&lt;Back</a>';

// If there are users
else {

// Set header to download users

echo '
<a href="dateandprinted.php?date='.$date.'"><FONT SIZE="5" >Printed</FONT></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="dateandnotprinted.php?date='.$date.'"><FONT SIZE="5" >Not Printed</FONT></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="dateandapproved.php?date='.$date.'"><FONT SIZE="5" >Approved</FONT></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="dateandnotapproved.php?date='.$date.'"><FONT SIZE="5" >Not Approved</FONT></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<hr align="Center" size="1">


People attending '.$date.'<br><br>
<table border="1">
<td width="150">Phone&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
// Show data for each user
while($u = mysql_fetch_array($users)) {
echo '
<td><a href="edit2.php?RegID='.$u['RegID'].'">Update</a></td>
<td><a href="view.php?RegID='.$u['RegID'].'">View</a></td>
<td><a href="print.php?RegID='.$u['RegID'].'">Print</a></td>
echo '</table> <br><br>Number Of Attendees is '.$count.'<br><br><a href="bih.html">Back</a>';

// End table


// download on click
if (!$_POST['search']) {
echo ' <center><h2>Download Program Signups.</h2></center><br><br>
<form method="post" action="">
<b>Date:</b> <select name="date" size="1">
<option selected value="">Program...</option>
<option value="For My Life 04/22/07 - 04/28/07">For My Life 04/22/07 - 04/28/07</option>
<option value="For My Life 04/29/07 - 05/05/07">For My Life 04/29/07 - 05/05/07</option>
<option value="For My Life 05/13/07 - 05/19/07">For My Life 05/13/07 - 05/19/07</option>
<option value="For My Life 05/20/07 - 05/26/07">For My Life 05/20/07 - 05/26/07</option>
<option value="For Their Life 05/20/07 - 05/26/07">For Their Life 05/20/07 - 05/26/07</option>
<option value="For My Life 06/03/07 - 06/09/07">For My Life 06/03/07 - 06/09/07</option>
<option value="For My Life Childrens 06/03/07 - 06/09/07">For My Life Childrens 06/03/07 - 06/09/07</option>
<option value="For My Life 06/10/07 - 06/16/07">For My Life 06/10/07 - 06/16/07</option>
<option value="For Their Life 06/10/07 - 06/16/07">For Their Life 06/10/07 - 06/16/07</option>
<option value="For My Life 06/24/07 - 06/30/07">For My Life 06/24/07 - 06/30/07</option>
<option value="For My Life 07/08/07 - 07/14/07">For My Life 07/08/07 - 07/14/07</option>
<option value="For Their Life 07/08/07 - 07/14/07">For Their Life 07/08/07 - 07/14/07</option>
<option value="For My Life 07/22/07 - 07/28/07">For My Life 07/22/07 - 07/28/07</option>
<option value="For My Life 07/29/07 - 08/4/07">For My Life 07/29/07 - 08/4/07</option>
<option value="For Their Life 07/29/07 - 08/4/07">For Their Life 07/29/07 - 08/4/07</option>
<option value="For My Life 08/12/07 - 08/18/07">For My Life 08/12/07 - 08/18/07</option>
<option value="For My Life Childrens 08/12/07 - 08/18/07">For My Life Childrens 08/12/07 - 08/18/07</option>
<option value="For My Life 08/19/07 - 08/25/07">For My Life 08/19/07 - 08/25/07</option>
<option value="For Their Life 08/19/07 - 08/25/07">For Their Life 08/19/07 - 08/25/07</option>
<option value="For My Life 09/02/07 - 09/08/07">For My Life 09/02/07 - 09/08/07</option>
<option value="For My Life 09/09/07 - 09/15/07">For My Life 09/09/07 - 09/15/07</option>
<option value="For Their Life 09/09/07 - 09/15/07">For Their Life 09/09/07 - 09/15/07</option>
<option value="For My Life 09/23/07 - 09/29/07">For My Life 09/23/07 - 09/29/07</option>
<option value="For My Life 09/30/07 - 10/06/07">For My Life 09/30/07 - 10/06/07</option>
<option value="For My Life 10/14/07 - 10/20/07">For My Life 10/14/07 - 10/20/07</option>
<option value="For My Life Childrens 10/14/07 - 10/20/07">For My Life Childrens 10/14/07 - 10/20/07</option>
<option value="For My Life 10/21/07 - 10/27/07">For My Life 10/21/07 - 10/27/07</option>
<option value="For Their Life 10/21/07 - 10/27/07">For Their Life 10/21/07 - 10/27/07</option>
<option value="For My Life 11/04/07 - 11/10/07">For My Life 11/04/07 - 11/10/07</option>
<option value="For My Life 11/11/07 - 11/17/07">For My Life 11/11/07 - 11/17/07</option>
<option value="For Their Life 11/11/07 - 11/17/07">For Their Life 11/11/07 - 11/17/07</option>
<option value="For My Life 11/25/07 - 12/01/07">For My Life 11/25/07 - 12/01/07</option>
<option value="For My Life 12/02/07 - 12/08/07">For My Life 12/02/07 - 12/08/07</option>
<option value="For Their Life 12/02/07 - 12/08/07">For Their Life 12/02/07 - 12/08/07</option>
<option value="For My Life 12/09/07 - 12/15/07">For My Life 12/09/07 - 12/15/07</option>
<input type="submit" name="search" value="Search" />
</form><br><br><br><a href="bih.html">&lt;&lt;Back</a>';


as you can see there is no way to tell if a person has been approved other than going to each week and sorting. by the way my sort is a field that each user has assigned at signup. i set it to 0 by default meaning he is not approved. to approve them i run this little bit of code on that person setting them to 1 in that field so i can defrentiate


// Get the user id
$RegID = $_GET['RegID'];

// Get data from user with the specified id
$info = mysql_query("SELECT * FROM `form` WHERE RegID = '$RegID'") or die ('Error Getting User Data! <br />' .mysql_error());
$chk = mysql_num_rows($info);
$u = mysql_fetch_array($info);
$dateout = $u['Date'];
// If edit not hit
if (!$_POST['edit']) {

// If user id returns no results
if ($chk < 1) {
echo 'The user with the id <b>'.$u['RegID'].'</b> does not exist!';
else {
// Edit Form
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="edit2.php?RegID='.$u['RegID'].'"><FONT SIZE="5" >Update</a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="delete.php?act=chk_del&RegID='.$u['RegID'].'">Delete</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="print.php?RegID='.$u['RegID'].'">Print</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="view.php?RegID='.$u['RegID'].'">View</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="approve.php?RegID='.$u['RegID'].'">Approve</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="bih.html">Back To Main</FONT></a><br><hr align="Center" size="1"><br>

$update = mysql_query("UPDATE `form` SET Approved = '1' WHERE RegID = '$RegID'") or die ('Error Updating Data! <br />' .mysql_error());
echo 'User Approved!';


hope this clarifies. all i want to do is have a way to possible change the background color or text color in the date dropdown that the administrative users choose from so that they can see at a glance which weeks have new signups they have not looked at yet.

thanks for you thoughts.