troubleshooting Question

Setting default value of Dropdown

Avatar of SeanDoherty49
SeanDoherty49 asked on
PHPScripting Languages
22 Comments1 Solution530 ViewsLast Modified:
I have populated a dropdown box, and I have selected the the default value ($Current) that I want to set it to.  This is working fine.  I just want to set the DropDown to $Current.
 
The code is shown below.
 
Any help would be much appreciated.
 
Thanks
John
 
<?php
mysql_select_db($database_mcr500, $mcr500);
$query_NextRideOut = "SELECT  coursedates.Filename, coursedates.CourseDates, coursedates.Destination FROM coursedates WHERE coursedates.CourseDates >= '$date' ORDER BY coursedates.CourseDates";
$NextRideOut = mysql_query($query_NextRideOut, $mcr500) or die(mysql_error());
$row_NextRideOut = mysql_fetch_assoc($NextRideOut);
$totalRows_NextRideOut = mysql_num_rows($NextRideOut);
 
if ($totalRows_NextRideOut>0)
  { $Current = $row_NextRideOut['Filename'].$row_NextRideOut['Destination']; }
else
  { $Current = $row_Courses['Filename'].$row_NextCourses['Destination'];}
?>
 
<select name="CourseDates"  ID = "21" size="1" Style="float:right" Width = "300"  onchange"javascript:ajax_post()" method = "post";>
 
 
 <?php do {  ?>
 <option value=" <?php echo $row_Courses['Filename'].$row_Courses['CourseDates']?>">
 <?php echo $row_Courses['CourseNo'].".....".$row_Courses['CourseDates'].".....".$row_Courses['Destination']?></option>
 <?php
 
 }
 while ($row_Courses = mysql_fetch_assoc($Courses));
 $rows = mysql_num_rows($Courses);
 if($rows > 0) {
     mysql_data_seek($Courses, 0);
     $row_Courses = mysql_fetch_assoc($Courses);
  } 
?>
DropDown.doc
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 22 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 22 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros