Well, here is my code, but for some reason the drop-down list doesn't seem to produce the right day except the first time:
Code:
$today = date ('Y-m-d');
if(isset($_GET['startdate']) && $_GET['startdate'] != ''){
$day = date('w',strtotime($_GET['startdate']));
} else {
$day = date('w',strtotime($today));
}
?>
<div id="ongoing">
<form action="/php/ongoing-new2.php" method="GET" name="SelectDay" class="datedrop">
<span class="h1">ONGOING EVENTS For: </span> <select name="day" onChange="document.SelectDay.submit()" class="datedrop">
<option value=1 <?php if ($_GET['day'] =="1"){ echo " selected"; } ?> >MONDAY </option>
<option value=2 <?php if ($_GET['day'] =="2"){ echo " selected"; } ?> >TUESDAY </option>
<option value=3 <?php if ($_GET['day'] =="3"){ echo " selected"; } ?> >WEDNESDAY </option>
<option value=4 <?php if ($_GET['day'] =="4"){ echo " selected"; } ?> >THURSDAY </option>
<option value=5 <?php if ($_GET['day'] =="5"){ echo " selected"; } ?> >FRIDAY </option>
<option value=6 <?php if ($_GET['day'] =="6"){ echo " selected"; } ?> >SATURDAY </option>
<option value=0 <?php if ($_GET['day'] =="0"){ echo " selected"; } ?> >SUNDAY </option>
</select> <input type="submit" value=" GO ">
</form>
<?php
$sql = "SELECT DISTINCT event.event_id, ev_title, description, loc_id FROM event, recur WHERE event.event_id = recur.event_id
AND recur.`dayofweek` = '".$day."' AND event.ongoing > 0 ORDER by ev_title ";
$result = mysql_query($sql,$connection) or die("Couldn't execute $sql query. <br> mysql error: ".mysql_error());
while ($row = mysql_fetch_array($result))
{
$event_id = $row[event_id];
$ev_title = $row[ev_title];
$description = $row[description];
$desc = substr($description, 0, 123);
$loc_id = $row[loc_id]; ?>
<a href="/php/event-detail.php?event_id=<?php echo $event_id; ?>"><?php echo $ev_title; ?></a><br>
<?php echo $desc; ?>...<a href="/php/event-detail.php?event_id=<?php echo $event_id; ?>">More</a><br>
<?php } ?>
</div><!--end ongoing
I could even live without the alternating rows if the code would just work reliably. Thanks very much.
Thanks for the info about the hex codes...that clears up a lot of mysteries for me.
Bookmarks