Form Action

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • poisonvm
    New Member
    • Apr 2009
    • 6

    Form Action

    Hi i have the following code;

    Code:
    <br>FanIn:
    <form action = "faninon.php " method ="post"> <input type = "submit" value="ON"/> </form>
    <form action = "faninoff.php " method ="post"> <input type = "submit" value="OFF"/> </form>
    </br>
    this display the buttons one above the other, how can i put them side by side.

    Thank you
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    there are (like always) several ways to accomplish that.
    • use only one form and 2 submit buttons. change the action attribute onsubmit through Javascript
    • float the forms
    • position them (absolute or relative)
    • play with the margins

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      Yet another option: one action page and use radio buttons for Yes and No and one submit button.

      Comment

      • poisonvm
        New Member
        • Apr 2009
        • 6

        #4
        Hello thanks for your responce, i will look into putting radio buttons as my final design needed that.But i am not sure i know how to send the correct value associated with it.
        My final version of the wed page was to do this---

        The "index.php" page redirects me to lighton1.php when i click the ON button. When i go to "lighton1.p hp" the page runs a script and it finishes.
        what i want to do is rather than creating another page lightoff1.php, I have one page let say Inprogress.php which receives a value from "index.php" say "L11" and parses that $varname to the ./dosomething.out .$varname.

        And once it finishes it redirects the back to the index.php.

        let me know if you know how to do this.
        I really appreciate your help. thanks
        ------------------------------------------------------------------------------------------------------------------

        Code:
        index.php
        
        <html>
        <body>
        
        
        <br>Light1:
        <form action = "lighton1.php " method ="post"> <input type = "submit" value="ON"/> </form>
        <form action = "lightoff1.php " method ="post"> <input type = "submit" value="OFF"/> </form>
        </br>
        
        </body>
        </html>
        Code:
        lighton1.php
        
        <html>
        <head/>
        <body>
        <h2> Success </h2>
        <?php 
        print 'Light is turned ON';
        $var_name = "L11";
        echo shell_exec("./send.out ".$var_name);
        ?>
        </body>
        </html>
        Last edited by eWish; Apr 10 '09, 02:15 AM. Reason: Added code tags

        Comment

        • David Laakso
          Recognized Expert Contributor
          • Aug 2008
          • 397

          #5
          Right forum. Wrong board. (X)HTML/CSS does not deal with behavior.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Yes, you need to ask your question in the PHP forum.
            Originally posted by poisonvm
            i will look into putting radio buttons as my final design needed that.But i am not sure i know how to send the correct value associated with it.
            This is done automatically by the browser. If a value is selected, this is passed onto the next page when submitted. In your PHP page, check the value posted/submitted (or if it's even set).

            Comment

            • poisonvm
              New Member
              • Apr 2009
              • 6

              #7
              Thanks guys........... .....

              Comment

              • poisonvm
                New Member
                • Apr 2009
                • 6

                #8
                -----------------------------------------------------------------------------

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  Was there something you wanted to say?

                  Comment

                  Working...