Integrating multiple php files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alex

    Integrating multiple php files

    Hi, I'll be as brief and clear as possible.
    - I have one base file which displays few checkboxes and 3 buttons.
    - depending on which button is clicked I must invoke different php
    script (3 different php files - one for each button)
    - I have to pass checkboxes values ( all are in array checkbox[] ) to
    one of the 3 scripts.

    How would I do that? That's something like invoking each script with
    $_POST[]. Do I use echo "get_file_conte nts(
    scriptname.php? checkbox[]=$_POST['checkbox']&checkbox1=$_PO ST[checkbox1])"
    ?


    Each script works fine if I implement checkboxes right into it. But I'm
    confused on how to pass an array (of checkboxes) to a different script.

    Regards,

  • Alex

    #2
    Re: Integrating multiple php files

    Let me clarify. When I use <form action="filenam e.php> I actually must
    invoke 3 different forms depending on which button was clicked. How can
    I achive something like double form action?

    Regards,

    Comment

    • David Haynes

      #3
      Re: Integrating multiple php files

      Alex wrote:[color=blue]
      > Let me clarify. When I use <form action="filenam e.php> I actually must
      > invoke 3 different forms depending on which button was clicked. How can
      > I achive something like double form action?
      >
      > Regards,
      >[/color]
      Call an intermediate page (say foo.php) which then coordinates the
      calling of forms a, b, and c.

      -david-

      Comment

      • Berimor

        #4
        Re: Integrating multiple php files

        On Fri, 13 Jan 2006 01:31:46 +0200, Alex <askunixguru@gm ail.com> wrote:
        [color=blue]
        > Hi, I'll be as brief and clear as possible.
        > - I have one base file which displays few checkboxes and 3 buttons.
        > - depending on which button is clicked I must invoke different php
        > script (3 different php files - one for each button)
        > - I have to pass checkboxes values ( all are in array checkbox[] ) to
        > one of the 3 scripts.[/color]

        Use JavaScript.

        [color=blue]
        > How would I do that? That's something like invoking each script with
        > $_POST[]. Do I use echo "get_file_conte nts(
        > scriptname.php? checkbox[]=$_POST['checkbox']&checkbox1=$_PO ST[checkbox1])"
        > Each script works fine if I implement checkboxes right into it. But I'm
        > confused on how to pass an array (of checkboxes) to a different script.[/color]
        [color=blue]
        >
        > Regards,
        >[/color]



        --
        ---
        Exact Meta Search | Major Search Engine http://exactsearcher.com
        Web Design Essex | Multimedia | Printing http://nextwave.co.uk

        Comment

        • Peter Fox

          #5
          Re: Integrating multiple php files

          Following on from David Haynes's message. . .[color=blue]
          >Alex wrote:[color=green]
          >> Let me clarify. When I use <form action="filenam e.php> I actually must
          >> invoke 3 different forms depending on which button was clicked. How can
          >> I achive something like double form action?
          >>
          >> Regards,
          >>[/color]
          >Call an intermediate page (say foo.php) which then coordinates the
          >calling of forms a, b, and c.[/color]

          Or put the buttons on different forms. (But solution above is better
          'cos you handle the other data in the form just submitted /then/ go to
          the next one.)




          --
          PETER FOX Not the same since the bolt company screwed up
          peterfox@eminen t.demon.co.uk.n ot.this.bit.no. html
          2 Tees Close, Witham, Essex.
          Gravity beer in Essex <http://www.eminent.dem on.co.uk>

          Comment

          • Alex

            #6
            Re: Integrating multiple php files

            Thank you guys. I actually worked out a solution proposed by David
            Haynes. I used an intermideate file and used reqire() statements
            depending on which button was pressed.

            Comment

            • Michael Austin

              #7
              Re: Integrating multiple php files

              Alex wrote:
              [color=blue]
              > Thank you guys. I actually worked out a solution proposed by David
              > Haynes. I used an intermideate file and used reqire() statements
              > depending on which button was pressed.[/color]

              another method is to use the switch function
              case 1 include a.php
              case 2 include b.php
              etc...

              [color=blue]
              >[/color]


              --
              Michael Austin.
              Consultant

              Comment

              Working...