Page 1 of 1

Multiple "Submit" areas on one page

Posted: Mon May 05, 2008 8:53 am
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

Re: Multiple "Submit" areas on one page

Posted: Mon May 05, 2008 9:10 am
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>
 
 

Re: Multiple "Submit" areas on one page

Posted: Mon May 05, 2008 9:11 am
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.

Re: Multiple "Submit" areas on one page

Posted: Mon May 05, 2008 9:16 am
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.

Re: Multiple "Submit" areas on one page

Posted: Mon May 05, 2008 10:04 am
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?

Re: Multiple "Submit" areas on one page

Posted: Mon May 05, 2008 10:06 am
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

Re: Multiple "Submit" areas on one page

Posted: Mon May 05, 2008 10:10 am
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???

Re: Multiple "Submit" areas on one page

Posted: Mon May 05, 2008 10:50 am
by yacahuma
what I mean is each html element, like select, textfield, texarea, etc