+ Reply to Thread
Results 1 to 2 of 2

Thread: PHP button problem

  1. #1
    Join Date
    Jun 2009
    Posts
    2

    Default PHP button problem

    hi......
    I have 2 button.
    I want each of them submit form and when open a.php give $id to that page.
    for example.
    if $id =20: (../a.php?20 ).
    Code:
    <html>
    
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <title>Untitled 1</title>
    </head>
    
    <body>
    
    <form method="post" action="a.php">
        <input name="Button1" type="button" value="button1" /><input name="Text1" type="text"></form>
    <p><input name="Button2" type="button" value="button2" /><input name="Text2" type="text"></p>
    
    </body>
    
    </html>
    <?php
    $id=20;
    ?>
    //../a.php?id=20

  2. #2
    Join Date
    Apr 2008
    Posts
    407

    Default

    I can barely understand what you're asking, but I'll give it a shot...

    Code:
    <?php
    $id=20;
    ?>
    <html>
    
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <title>Untitled 1</title>
    </head>
    
    <body>
    
    <form method="post" action="a.php?id=<?php echo $id; ?>">
        <input name="Button1" type="submit" value="button1" /><input name="Text1" type="text"></form>
    <p><input name="Button2" type="submit" value="button2" /><input name="Text2" type="text"></p>
    
    </body>
    
    </html>
    When either button is clicked, it will submit the form and take the user to a.php?id=20.

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts