Connecting Tech Pros Worldwide Forums | Help | Site Map

Form Action

Newbie
 
Join Date: Apr 2009
Posts: 6
#1: Apr 9 '09
Hi i have the following code;

Expand|Select|Wrap|Line Numbers
  1. <br>FanIn:
  2. <form action = "faninon.php " method ="post"> <input type = "submit" value="ON"/> </form>
  3. <form action = "faninoff.php " method ="post"> <input type = "submit" value="OFF"/> </form>
  4. </br>
this display the buttons one above the other, how can i put them side by side.

Thank you

Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,656
#2: Apr 9 '09

re: Form Action


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
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#3: Apr 9 '09

re: Form Action


Yet another option: one action page and use radio buttons for Yes and No and one submit button.
Newbie
 
Join Date: Apr 2009
Posts: 6
#4: Apr 9 '09

re: Form Action


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.php" 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
------------------------------------------------------------------------------------------------------------------

Expand|Select|Wrap|Line Numbers
  1. index.php
  2.  
  3. <html>
  4. <body>
  5.  
  6.  
  7. <br>Light1:
  8. <form action = "lighton1.php " method ="post"> <input type = "submit" value="ON"/> </form>
  9. <form action = "lightoff1.php " method ="post"> <input type = "submit" value="OFF"/> </form>
  10. </br>
  11.  
  12. </body>
  13. </html>
  14.  
Expand|Select|Wrap|Line Numbers
  1. lighton1.php
  2.  
  3. <html>
  4. <head/>
  5. <body>
  6. <h2> Success </h2>
  7. <?php 
  8. print 'Light is turned ON';
  9. $var_name = "L11";
  10. echo shell_exec("./send.out ".$var_name);
  11. ?>
  12. </body>
  13. </html>
  14.  
Expert
 
Join Date: Aug 2008
Posts: 397
#5: Apr 9 '09

re: Form Action


Right forum. Wrong board. (X)HTML/CSS does not deal with behavior.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#6: Apr 10 '09

re: Form Action


Yes, you need to ask your question in the PHP forum.
Quote:

Originally Posted by poisonvm View Post

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).
Newbie
 
Join Date: Apr 2009
Posts: 6
#7: Apr 10 '09

re: Form Action


Thanks guys................
Newbie
 
Join Date: Apr 2009
Posts: 6
#8: Apr 29 '09

re: Form Action


-----------------------------------------------------------------------------
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#9: Apr 30 '09

re: Form Action


Was there something you wanted to say?
Reply

Tags
action, buttons, form