Dynamic forms

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
Todlerone
Forum Commoner
Posts: 96
Joined: Sun Oct 28, 2007 10:20 pm
Location: Hamilton, Ontario, Canada

Dynamic forms

Post by Todlerone »

Hello everyone. I'm new to php programming and have several questions about forms. I'm curious to see if what I want to do is possible before I invest alot of time to piece the code together. I'm putting together a web page for my baseball league as they don't have any at the time of this post. I'm also using MySQL to hold all of the game dates, game locations, home and visitor teams. I want to add a dynamic form to my administration page to allow the league director or myself the chance of changing a game date, location, etc. So here it goes

1) I would like to access my MySQL database to populate a list on my form for the game dates available. No any date, only the dates already pre-entered in the data base.

2) When a particular date is selected, is it possible to populate three other form list entries with the corresponding location, home team and visitor team for the selected date. This would provide an immediate visual to the director and/or myself that the correct row is selected (however, this is not necessary).

3) I want to populate the lists for location, home team and visitor team with the DISTINCT code to select the corresponding info only once. I could easily hard code the values but would like the flexibility for adding/removing teams in the database in the future.

4) Once the date, location, team home and team visitor have been adjusted, I need to change the old dates team home and team visitor to "OPN" to allow us to know it's availability.

Thank-you in advance.....
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

Yes, it's possible. In fact, very common coding!
Give your games a unique id in the database table, and your coding should be a breeze. :)
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

What you want to do is certainly possible. It is actually pretty easy too. From what it sounds like in your post you are going to want to be doing a little bit of Javascript coding as well, bu even without it, you can still do what you want pretty easily.
Todlerone
Forum Commoner
Posts: 96
Joined: Sun Oct 28, 2007 10:20 pm
Location: Hamilton, Ontario, Canada

Post by Todlerone »

Thanks for the responses. I would prefer not to use the javascript (if it is possible as I would like to learn/understand PHP/MySQL alittle better before I dive into learning that also). I have found alot of sample codes to do parts of what I want. I have seen code to query my database then split the $result into separate arrays for each field of my table, etc, etc. I don't have a problem with any of the code to post a <value> listing my database results. The part I can't get my head around is within the form itself. I need 4 text areas, the first one needs to populate the other three. Is there a way of knowing which row the first "Date" text field is. I do have a unique GameID (auto increment) field in my database. If javascript is really easy for this does anyone have a link to a sample of it.

Again thank-you in advance... :D
Post Reply