help me! i want to print two values with two diff submitt button at same page!

Discussion in 'PHP' started by Roshaan.N, Apr 22, 2012.

  1. #1
    <html>
    <body>
    <form action="get1.php" method="GET">
    name: <input type="text" name="fname"/>
    <input type="submit" />
    </form>

    <form action="get1.php" method="GET">
    name: <input type="text" name="fname1"/>
    <input type="submit" />
    </form>

    <?php
    $f=$_GET["fname"];
    $f1=$_GET["fname1"];
    echo $f.$f1;
    ?>

    WHY CAN'T I PRINT BOTH VALUES? GIVE ME A SOLUTION.

    </body>
    </html>
     
    Solved! View solution.
    Roshaan.N, Apr 22, 2012 IP
  2. #2
    Why don't you use one form with two different submit buttons

    <form action="get1.php" method="GET">
      name: <input type="text" name="fname"/>
      name: <input type="text" name="fname1"/>
    
      <button name="subject" type="submit" value="submit1">submit1</button>
      <button name="subject" type="submit" value="submit2">submit2</button>
    </form>
    HTML:
     
    Last edited: Apr 22, 2012
    Tawfik64, Apr 22, 2012 IP
  3. raspms

    raspms Peon

    Messages:
    48
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    ya this one is right..you can try out this one..
     
    raspms, Apr 23, 2012 IP
  4. paparts

    paparts Active Member

    Messages:
    112
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    both ibput should be under 1 form
     
    paparts, Apr 26, 2012 IP