PHP not getting variables in HTML forms

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Titus

    PHP not getting variables in HTML forms

    Hi,

    Just installed PHP, and Apache. Am having problems with the PHP to
    get form data from an HTML file. Specifically, I can not obtain the
    variable "tireqty" in a PHP file called by an HTML file. The files'
    contents are listed as follow:

    -----------------------------
    The following is the HTML file
    -----------------------------
    <form action="process order.php" method=post>
    <table border=0>
    <tr bgcolor=#cccccc >
    <td width=150>Item</td>
    <td width=15>Quanti ty</td>
    </tr>
    <tr>
    <td>Tires</td>
    <td align=center><i nput type="text" name="tireqty" size=3
    maxlength=3></td>
    </tr>
    <tr>
    <td colspan=2 align=center><i nput type=submit value="Submit
    Order"></td>
    </tr>
    </table>
    </form>
    -----------------------------
    The following is the PHP file 'processorder.p hp'
    -----------------------------
    <html>
    <head>
    <title>abcd</title>
    </head>
    <body>
    <?
    echo $tireqty." tires<br>";
    ?>
    </body>
    </html>
    -----------------------------
    I know PHP and Apache are working becasue I am able to to have an HTML
    page to load a PHP page to do a for loop and use the "echo" function
    to print the loop iterations. So I'm not sure why PHP can't access
    the variable "tireqty". Is there some settings in the PHP engine that
    I need to check for this?

    Thanks
  • Justin Koivisto

    #2
    Re: PHP not getting variables in HTML forms

    Titus wrote:
    [color=blue]
    > Specifically, I can not obtain the
    > variable "tireqty" in a PHP file called by an HTML file.[/color]
    [color=blue]
    > -----------------------------
    > The following is the HTML file
    > -----------------------------
    > <form action="process order.php" method=post>
    > <input type="text" name="tireqty" size=3
    > maxlength=3>
    > <input type=submit value="Submit
    > Order">
    > </form>
    > -----------------------------
    > The following is the PHP file 'processorder.p hp'
    > -----------------------------
    > <?
    > echo $tireqty." tires<br>";
    > ?>
    > -----------------------------[/color]
    [color=blue]
    > I'm not sure why PHP can't access
    > the variable "tireqty". Is there some settings in the PHP engine that
    > I need to check for this?[/color]

    echo $_POST['tireqty']." tires<br>";

    register_global s:


    --
    Justin Koivisto - spam@koivi.com
    PHP POSTERS: Please use comp.lang.php for PHP related questions,
    alt.php* groups are not recommended.

    Comment

    Working...