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 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    27
    Thanks
    0
    Thanked 0 Times in 0 Posts

    cannot submit forms to mysql

    hi there. i am having some trouble with this script, and was wondering if someone could help me out.

    the script:

    PHP Code:
    <?php
    if ($test) { printf"test worked");};

    ?>
    <form method="post" action="<?php echo $PHP_SELF ?>">
    <input type="submit" name="test" value="submit">
    </form>
    That is the simplest i could come up with. When you click on the submit button, it should show "test workd" above it.

    this will not work. I have taken it to another server with php/mysql, and it worked there (i did change the db and table names).

    i have another script to commuicate with mysql, but i will worry about that later, since i cant even get this one to work.

    does anyone have any suggestions?

    thanks alot,

    dan
    dan

  • #2
    Regular Coder
    Join Date
    Sep 2002
    Location
    British Columbia
    Posts
    235
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try $_POST['test'] rather than $test

  • #3
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    Also, it's $_SERVER['PHP_SELF'] and not $PHP_SELF. You'll need to get used to working with the super globals to ensure your scripts will work on any server and are more secure


  •  

    Posting Permissions

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