Question about form in PHP and MySQL

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • peter_ross@canada.com

    #1

    Question about form in PHP and MySQL

    Hi,

    I am new to PHP and MySQL. I was writing a script to pull data from
    SQL server and display the data. There's a "submit" button. When the
    user clicks "submit", the form calls itself and I "expect" the submit
    value is set. However, I find the $submit is never set. Is there
    something wrong with my script?

    Thanks,
    Ross

    <?php
    include("conten tdb.php");
    $display = mysql_query("SE LECT * FROM $table ORDER BY id",$db);

    if (!$submit) {
    echo "<form method=post action=$PHP_SEL F>";

    // code to display questions

    echo "<input type='submit' value='SUBMIT' name='submit'>" ;
    echo "</form>";
    }

    if ($submit) {
    // calculate scores
    }
    ?>

  • Gordon Burditt

    #2
    Re: Question about form in PHP and MySQL

    >I am new to PHP and MySQL. I was writing a script to pull data from[color=blue]
    >SQL server and display the data. There's a "submit" button. When the
    >user clicks "submit", the form calls itself and I "expect" the submit
    >value is set. However, I find the $submit is never set. Is there
    >something wrong with my script?[/color]

    Use $_POST['submit'], not $submit .
    'register_globa ls' is evil.

    Gordon L. Burditt

    Comment

    Working...