简体   繁体   中英

dynamic links / dropdown menu

I have a drop down box that dynamically creates the option items by running a sql query. However, I also want these options to link to a page where the anchor is also the value of the option. ie mysite.com/date.php#april if April is clicked on. As you can see, I have the anchor # in there, but I cant figure out how to add the dynamic variable ($startdate).

This is my first post; let me know if additional info is required.

echo '<select onChange="location=(this.value)";>';
echo '<option value="date.php#">';
echo date('F Y', mktime(0, 0, 0, $startdate[1], $startdate[2], $startdate[0]));
echo '</option>';
<?php
$date = date('F Y', mktime(0, 0, 0, $startdate[1], $startdate[2], $startdate[0]));
echo '<select onChange="location=(this.value)";>';
echo '<option value="date.php#' . $date . '">' . $date . '</option>';

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM