Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    TrainReq
    Guest

    Working with Submit Buttons and PHP

    Ok... I am doing this project just for test purposes. I have two submit buttons , one with the value of "Test 1" and one with the value of "Test Two" , both with the name of "test" , what I would like to do is echo the value of the submit button pressed. For instance, if you press the button with value of Test One , it will echo on the PHP page "Test One".

    Here is the HTML I have:

    Code:
     <form action="process.php method="post">
    <input type="submit" name="test" value="Test 2"><br><input type="submit" name="test" value="Test 1"></form>
    Here is the PHP I have:
    PHP Code:
    <? echo $_POST['test']; ?>
    It is not echoing the value. Why am I having this issue?

  • #2
    New Coder
    Join Date
    Nov 2007
    Posts
    12
    Thanks
    0
    Thanked 1 Time in 1 Post
    PHP Code:
    <?php echo $_POST['test']; ?>
    <form action="process.php" method="post">
    <input type="submit" name="test" value="Test 2"><br>
    <input type="submit" name="test" value="Test 1">
    </form>
    you had a missing endquote around "process.php"
    maybe this is the simple issue
    Last edited by phpBuddy; 11-10-2007 at 03:23 PM.
    echo "PHP 5.2.5";
    exit ( "Script End" );


  •  

    Posting Permissions

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