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

Multiple "Submit" areas on one page

Post by Todlerone »

Hello everyone, happy Monday...yuk (I hate Mondays). Thank-you in advance for any help/suggestions for this posting. I love this site, it rocks. I'm currently making a "teams" page for my baseball league web site and have come across a little snag. Instead of making an individual page for each team in the league I want to make it a dynamic page which will load the MySQL data into the page based on a form to select a team. I want this page to display all the information I currently have for each team in a nice little bundle. On this page I also want to have a a form to select a schedule (which itself will have multiple values). So my question is: How should I go about dealing with the multiple forms when posting back to the same page. Not looking for the code as much as to the process involved.

Thank-you...CHEERS
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: Multiple "Submit" areas on one page

Post by yacahuma »

i dont understand why you need multiple forms but if thats what you want

Code: Select all

 
<?
if (isset($_POST['submit_1_btn']))
{
  //process form 1
}
else if if (isset($_POST['submit_2_btn']))
{
  //process form 2
}
?>
 
<form name="form1" action="thispage.php" method="post">
<input type="submit" name="submit_1_btn" />
</form>
 
<form name="form2" action="thispage.php" method="post">
<input type="submit" name="submit_2_btn" />
</form>
 
 
Todlerone
Forum Commoner
Posts: 96
Joined: Sun Oct 28, 2007 10:20 pm
Location: Hamilton, Ontario, Canada

Re: Multiple "Submit" areas on one page

Post by Todlerone »

Found something that may be possible. Wow, I'm talking to myself? Would I use

Code: Select all

$HTTP_POST_VARS
with the use of hidden fields? Not sure how to use them, but looks like a possible solution.
Todlerone
Forum Commoner
Posts: 96
Joined: Sun Oct 28, 2007 10:20 pm
Location: Hamilton, Ontario, Canada

Re: Multiple "Submit" areas on one page

Post by Todlerone »

The first one is to select a team from a list. This populates the page from the MySQL database. The other area is to allow the user (with the current selected team from the first "form") to select different types of schedules.
Todlerone
Forum Commoner
Posts: 96
Joined: Sun Oct 28, 2007 10:20 pm
Location: Hamilton, Ontario, Canada

Re: Multiple "Submit" areas on one page

Post by Todlerone »

To summerize. I'm sure I don't need the second submit button (the schedule submit). The main idea for this one is to allow the user to display the selected teams schedule or allow for 2 other schedule options (complete-all teams, parks or all available open diamonds) I'm thinking this one should be populated with javascript. However, I don't know js at all (heck...even php for the matter). Was just hoping there was a way (with php) to allow the first form to select a team from a dropdown list, then allow the user to alter the schedule <div> area for multiple selections. Make sense?
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: Multiple "Submit" areas on one page

Post by yacahuma »

you can do that but there is really no need to have that team selection box in a separate form. You can put any numbers of widgets in each form. it will just be another variable that is past on the form
Todlerone
Forum Commoner
Posts: 96
Joined: Sun Oct 28, 2007 10:20 pm
Location: Hamilton, Ontario, Canada

Re: Multiple "Submit" areas on one page

Post by Todlerone »

yacahuma wrote:you can do that but there is really no need to have that team selection box in a separate form. You can put any numbers of widgets in each form. it will just be another variable that is past on the form
Sorry yacahuma, noob here. What are you triing to say? Widget???
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

Re: Multiple "Submit" areas on one page

Post by yacahuma »

what I mean is each html element, like select, textfield, texarea, etc
Post Reply