Jump to content
xisto Community
Sign in to follow this  
soleimanian

Dropdown Box ?

Recommended Posts

Hey...I posted this same thing in another forum. I was wondering if anyone here knows how to make a dropdown box refresh the page after having a value change. In other words:I have a site, and I want to make it so that the main page displays news. I will have the news in a mySQL database, and I want it so that the main page contains a dropdown box with every possible date from the site's creation to the current date. When you change the value, the page refreshes and displays that day's news on the main page.

Share this post


Link to post
Share on other sites

Dear soleimanian,

Your problem description was interpreted by me,
and I came up with the following proposal:

<html><head><title>News Page</title></head><body><form><select onchange="location.href=this.option[this.selectedIndex].value" size="1"><option value="#">latest news:</option><option value="page20050503.html">May 3, 2005</option><option value="page20050502.html">May 2, 2005</option><option value="page20050501.html">May 1, 2005</option><option value="page20050430.html">April 30 2005</option><option value="page20050429.html">April 29 2005</option><option value="page20050428.html">April 28 2005</option><option value="page20050427.html">April 27 2005</option><option value="page20050426.html">April 26 2005</option><option value="page20050425.html">April 25 2005</option><option value="page20050424.html">April 24 2005</option><option value="page20050423.html">April 23 2005</option><option value="page20050422.html">April 22 2005</option><option value="page20050421.html">April 21 2005</option><option value="page20050420.html">April 20 2005</option><option value="page20050419.html">April 19 2005</option><option value="page20050418.html">April 18 2005</option><option value="page20050417.html">April 17 2005</option><option value="page20050416.html">April 16 2005</option><option value="page20050415.html">April 15 2005</option><option value="page20050414.html">April 14 2005</option><option value="page20050413.html">April 13 2005</option><option value="page20050412.html">April 12 2005</option><option value="page20050411.html">April 11 2005</option><option value="page20050410.html">April 10 2005</option><option value="page20050409.html">April 9 2005</option><option value="page20050408.html">April 8 2005</option><option value="page20050407.html">April 7 2005</option><option value="page20050406.html">April 6 2005</option><option value="page20050405.html">April 5 2005</option><option value="page20050404.html">April 4 2005</option><option value="page20050403.html">April 3 2005</option><option value="page20050402.html">April 2 2005</option><option value="page20050401.html">April 1 2005</option></select></form></body></html>


Of course, when you use PHP, you can dynamically make the page,
perhaps something like this proposal:

<html><head><title>News Page</title></head><body><form><select onchange="location.href=this.option[this.selectedIndex].value" size="1"><option value="#">latest news:</option><option value="page.php?date=20050503">May 3, 2005</option><option value="page.php?date=20050502">May 2, 2005</option><option value="page.php?date=20050501">May 1, 2005</option><option value="page.php?date=20050430">April 30 2005</option><option value="page.php?date=20050429">April 29 2005</option><option value="page.php?date=20050428">April 28 2005</option><option value="page.php?date=20050427">April 27 2005</option><option value="page.php?date=20050426">April 26 2005</option><option value="page.php?date=20050425">April 25 2005</option><option value="page.php?date=20050424">April 24 2005</option><option value="page.php?date=20050423">April 23 2005</option><option value="page.php?date=20050422">April 22 2005</option><option value="page.php?date=20050421">April 21 2005</option><option value="page.php?date=20050420">April 20 2005</option><option value="page.php?date=20050419">April 19 2005</option><option value="page.php?date=20050418">April 18 2005</option><option value="page.php?date=20050417">April 17 2005</option><option value="page.php?date=20050416">April 16 2005</option><option value="page.php?date=20050415">April 15 2005</option><option value="page.php?date=20050414">April 14 2005</option><option value="page.php?date=20050413">April 13 2005</option><option value="page.php?date=20050412">April 12 2005</option><option value="page.php?date=20050411">April 11 2005</option><option value="page.php?date=20050410">April 10 2005</option><option value="page.php?date=20050409">April 9 2005</option><option value="page.php?date=20050408">April 8 2005</option><option value="page.php?date=20050407">April 7 2005</option><option value="page.php?date=20050406">April 6 2005</option><option value="page.php?date=20050405">April 5 2005</option><option value="page.php?date=20050404">April 4 2005</option><option value="page.php?date=20050403">April 3 2005</option><option value="page.php?date=20050402">April 2 2005</option><option value="page.php?date=20050401">April 1 2005</option></select></form></body></html>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.