-
Adding CSS class to entries that are weekends
Hi, I have created an application through which a golf club can use online simple forms to add, edit and delete tee times as required. The problem I'm having is that I need to have a different background colour for entries that are weekends. Is this possible using PHP? I tried using this method but it doesn't seem to work.. <? if(date('D') == 'Sat' || date('D') == 'Sun'){ $class= 'weekend'; } else{ $class='weekday'; } ?> <? if($date != $row['date_added']) { $date = $row['date_added']; ?> <? echo date ("l jS, F", strtotime( $row['date_added'] )); ?> <? } ?> Many Thanks! -Steve
-
Checkboxes! IFs, POSTs and arrays...
Hmm.. Still getting the same thing How annoying! (not you my script! ) I was considering using the 'array_diff' but have yet to get that working.. Cheers for your help dude!
-
Checkboxes! IFs, POSTs and arrays...
Thanks so much for replying vertmonkee! I just tried to run this script and added some basic echos to see if it's displaying the right output. My problems are: • Checking boxes on the first page doesn't seem to effect the code below. It always states 'There are boxes unchecked' even if all the checkboxes are ticked on the previous page? • I don't know how to show which check boxes haven't been checked? Please help if you can! Thankyou!! <?php // Set a blank array to hold all of the unticked items $unticked = array(); // Assign the post values to a variable $ticked = $_POST; // Loop through the database results while($row = mysql_fetch_array($result)) { // Check if the current item is not in the ticked array if(!in_array($row['checklistitem'], $ticked)) { // The item does not appear in the ticked array so the user must have left it unticked // Add it to the unticked array $unticked[] = $row['checklistitem']; } } // Check if there are any unticked items and display them if so if(count($unticked) > 0) { echo "There are boxes unchecked!"; } else { echo "You've checked all the boxes!"; } ?>
-
Checkboxes! IFs, POSTs and arrays...
Hi, I have a set of checkboxes a bit like a checklist and I then want the items that aren't checked to displayed. On the first page, I have this code: <? while($row = mysql_fetch_array($result)) { ?> <form action="packed.php" method="post"> <div> <label><input type="checkbox" name="<? echo stripslashes($row['checklistitem']); ?>" value="yes"> <? echo stripslashes($row['checklistitem']); ?> </label> </div> This basically takes an array from a database. The info is then posted to the next page which hopefully will display the boxes which are 'unticked' or unchecked if you will. The code I have on the second page is: <?php $query_string = ""; if ($_POST) { $kv = array(); foreach ($_POST as $key => $value) { $kv[] = "$key"; } $query_string = join("<br />", $kv); } else { $query_string = $_SERVER['QUERY_STRING']; } echo $query_string; ?> At the moment, it returns the array items that were checked but I want the unchecked ones to be shown. Is that possible? Thanks very much! -Steve
-
Steve Coates
Hey! I'm Steve, I am studying web design/development at uni at the moment. I'm looking to help and get some help from these forums as well as getting generally involved with other web designers and keeping myself 'in-the-loop' as it were. Thank! -Steve