Hello Ian,

Thanks so much for the code example, going to try it out.



--- In php-list@yahoogroups.com, Ian Bambury <[EMAIL PROTECTED]> wrote:
>
> You need to
> a) give each button a name and check via isset(), or
> b) give each button a name of, say, sub[] and check the value of
> $_POST['sub'][0]
> c) you could use something like
> 
> $inc = "init";
> if(isset($_POST['sub'])) $inc = $_POST['sub'][0];
> include("inludefile_$inc.inc");
> 
> then you need:
> 
> inludefile_init.inc
> inludefile_Chart.inc
> inludefile_Play.inc
> 
> holding the scripts for each function
> 
> Here's an example for in-line code:
> 
> 
> 
> 
> <?php
> if(isset($_POST['sub']))
> {
>  switch($_POST['sub'][0])
>  {
>   case "Chart":
>    echo "Here's your chart...";
>    break;
>   case "Play":
>    echo "So you want to play, huh?";
>    break;
>   default:
>  }
> }
> else
> {
> ?>
> <form action="index.php" method="post">
> 
> <input value=100 name=userbankroll length="20"> Bankroll.<br>
> <input value=5 name=profit length="20"> Profit on a win.<br>
> <input value=2 name=startingunit length="20"> Beginning wager.<br>
> 
> <p>
> <input type="reset"><br>
> <input type="submit" name="sub[]" value="Chart"><br>
> <input type="submit" name="sub[]" value="Play"><br>
> </p>
> 
> </form>
> <?php
> }
> ?>
> 
> 
> 
> On 23/11/05, viewcharts <[EMAIL PROTECTED]> wrote:
> >
> > Once the php file is called, how do I know which submit button was
> > clicked? Would I need to set a hidden input box first?
> >
> >
> > --- In php-list@yahoogroups.com, Ian Bambury <[EMAIL PROTECTED]> 
wrote:
> > >
> > > option 3)
> > > if chart doesn't need the input data, use two forms
> > >
> > > option 4)
> > > have both scripts as different parts of the same .php file
> > >
> > > option 5)
> > > call one script, include different files dependent on the button
> > clicked
> > >
> > >
> > > On 22/11/05, Brian Cummiskey <[EMAIL PROTECTED]> wrote:
> > > >
> > > > viewcharts wrote:
> > > > > I want to call a different php script depending on if the 
user
> > clicks
> > > > > the Chart button or the Play button. Is this possible?
> > > >
> > > > yes and no...
> > > >
> > > > option 1)
> > > >
> > > > use javascript.  this has its obvious limitations...
> > > >
> > > > option 2)
> > > >
> > > > -make a middle-man page.
> > > > -check which button was submitted with the isset() function
> > > > -redirect to the proper php script you want for that button
> > > >
> > > >
> > > >
> > > > Community email addresses:
> > > >   Post message: php-list@yahoogroups.com
> > > >   Subscribe:    [EMAIL PROTECTED]
> > > >   Unsubscribe:  [EMAIL PROTECTED]
> > > >   List owner:   [EMAIL PROTECTED]
> > > >
> > > > Shortcut URL to this page:
> > > >   http://groups.yahoo.com/group/php-list
> > > >
> > > >
> > > >
> > > > SPONSORED LINKS
> > > >   Php mysql<http://groups.yahoo.com/gads?
> > 
t=ms&k=Php+mysql&w1=Php+mysql&w2=Job+postings&c=2&s=33&.sig=FLGkJVBUdD
> > Mln4PBO26sng> Job
> > > > postings<http://groups.yahoo.com/gads?
> > 
t=ms&k=Job+postings&w1=Php+mysql&w2=Job+postings&c=2&s=33&.sig=cV3rp9p
> > SpCxahJy7imon_w>
> > > >  ------------------------------
> > > > YAHOO! GROUPS LINKS
> > > >
> > > >
> > > >    -  Visit your group "php-
> > list<http://groups.yahoo.com/group/php-list>"
> > > >    on the web.
> > > >
> > > >    -  To unsubscribe from this group, send an email to:
> > > >     [EMAIL PROTECTED]<php-list-
> > [EMAIL PROTECTED]
subject=Unsubscribe<http://[EMAIL PROTECTED]/?
subject=Unsubscribe>
> > >
> > > >
> > > >    -  Your use of Yahoo! Groups is subject to the Yahoo! 
Terms of
> > > >    Service <http://docs.yahoo.com/info/terms/>.
> > > >
> > > >
> > > >  ------------------------------
> > > >
> > >
> > >
> > > [Non-text portions of this message have been removed]
> > >
> >
> >
> >
> >
> >
> >
> >
> > Community email addresses:
> >   Post message: php-list@yahoogroups.com
> >   Subscribe:    [EMAIL PROTECTED]
> >   Unsubscribe:  [EMAIL PROTECTED]
> >   List owner:   [EMAIL PROTECTED]
> >
> > Shortcut URL to this page:
> >   http://groups.yahoo.com/group/php-list
> >
> >
> >  ------------------------------
> > YAHOO! GROUPS LINKS
> >
> >
> >    -  Visit your group "php-
list<http://groups.yahoo.com/group/php-list>"
> >    on the web.
> >
> >    -  To unsubscribe from this group, send an email to:
> >     [EMAIL PROTECTED]<php-list-
[EMAIL PROTECTED]>
> >
> >    -  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> >    Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> >  ------------------------------
> >
> 
> 
> [Non-text portions of this message have been removed]
>






------------------------ Yahoo! Groups Sponsor --------------------~--> 
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/HKFolB/TM
--------------------------------------------------------------------~-> 

Community email addresses:
  Post message: php-list@yahoogroups.com
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to