Links using form data on same page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
subx
Forum Newbie
Posts: 2
Joined: Wed Oct 12, 2005 10:26 pm
Contact:

Links using form data on same page

Post by subx »

I'm not sure if this can be done in PHP, or if I have to go to javascript, which I don't know nearly as well, but I'm sure I could figure out, but want to avoid it if possible.

What I need to do is have, a date box (drop down or typed in, the type doesn't really matter), that affects a link when clicked.

For example:

A drop down list of the past 7 through the next 7 days at the top of the screen

Someone selects Tuesday 10/18

Now when they click a link on that page (say the link called blue), it would send them to http://www.example.com/blue/20051018. If they clicked on the red link, it would send them to http://www.example.com/red/20051018.

It's a simple idea, not sure if I explained myself quite right. I've just never had to work with something that effects the current page you are working on, so I don't even know if that's possible with just PHP, or where I would go to learn more about the javascript that would be required, any help?
Sequalit
Forum Commoner
Posts: 75
Joined: Wed Oct 12, 2005 9:57 pm
Location: Texas

Post by Sequalit »

i believe you could try something simple as having two submit buttons one named red and one blue... and send them to a page that will be used just for redirecting them...

so it takes the value they put in the dropdownbox/input text and then the name of which submit button they pressed, and then the script redirects them accordingly. should work.

-SeQ
subx
Forum Newbie
Posts: 2
Joined: Wed Oct 12, 2005 10:26 pm
Contact:

Post by subx »

I thought about something like that (actually thought about having a radio button for the link you want to activate and then a submit button), but there's a lot of links that need to go on the page.

It's actually going to be a start page for my web department at a newspaper, and I need approximately 3 sets of about 20-25 links each (there's 3 servers, an edit, stage and live, and you can change the dates on all 3 to see previous days or future days).

Right now we have to load a page and then change the date in the url manually, was hoping to make things a bit faster as it is something we use constantly every day, so my life would be easier, and of course it looks good come raise time.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

This sounds like using simple standard links, or worst case, something like a jumpbox. Jumpbox = <select> + onchange that switches URL's when changed. For an example of a jumpbox, look toward the bottom of this page. The combo box that says "Jump To:" is a jumpbox.
Post Reply