#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Location
    Tampa
    Posts
    58
    Rep Power
    11

    need help in php scripting


    I have to develop a page which has a form like this.

    It has one select box to select a value from the set of values. It has two buttons. If u click on any of these buttons it had to call a shell script and the selected value should be sent to that shell script.
    If i click on another button it has to call another shell script and the selected value should be sent to that shell script..

    please mail me the solution

    my id is sduggire@csee.usf.edu or dsridhar10@yahoo.co.in

    Thanks,
    Sridhar!
  2. #2
  3. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,183
    Rep Power
    2220
    Moved to Project Help Wanted from HTML /CSS/JS forum.
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn
  4. #3
  5. Banned (not really)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 1999
    Location
    Brussels, Belgium
    Posts
    14,640
    Rep Power
    4476
    If you'd of asked this in the PHP forum, you'd probably already have an answer. This should work... untested, of course:
    PHP Code:
    <?php

    if(isset($_REQUEST['submit1']) || isset($_REQUEST['submit2']))
    {
      if(isset(
    $_REQUEST['argument']))
      {
        
    $arg escapeshellarg($_REQUEST['argument']);
        if(isset(
    $_REQUEST['submit1']))
        { 
    $shell_script 'xx1'; }
        else
        { 
    $shell_script 'xx2'; }

        
    $last_line exec("$shell_script $arg",$result,$return_code);
      }
    }
    ?>
    <html>
      <body>
      <form method="POST" action="thispage.php">
        <select name="argument">
          <option value="arg1">arg1</option>
          <option value="arg2">arg2</option>
          <option value="arg3">arg3</option>
        </select>
        <input type="submit" name="submit1" value="Run Program 1">
        <input type="submit" name="submit2" value="Run Program 2">
      </form>
      </body>
    </html>
    ---John Holmes...
    -- Cigars, whiskey and wild, wild women. --

IMN logo majestic logo threadwatch logo seochat tools logo