Page 1 of 1

Newbie error question about variables

Posted: Thu Jun 16, 2005 10:33 pm
by blindleaf
ok i'm going through sams tutorial for mysql and php, and i'm going through one of the practice scripts right now. This script is trying to teach me how forms can work with php and how you can transfer data between pages. I'm getting the following errors on my page once i submit it:


Notice: Undefined variable: tireqty in C:\Server\Apache2\htdocs\sams\processorder.php on line 15
tires

Notice: Undefined variable: oilqty in C:\Server\Apache2\htdocs\sams\processorder.php on line 16
bottles of oil

Notice: Undefined variable: sparkqty in C:\Server\Apache2\htdocs\sams\processorder.php on line 17
spark plugs

can someone take a look at the code i have for my two files: orderform.html and processorder.php and see what i am doing wrong? thanks,

here's links to code for the two files:

orderform.html
processorder.php

hope to get a response, thank you,

Ryan

Posted: Thu Jun 16, 2005 10:40 pm
by Revan
Try $_POST["variable"]

Don't get used to using super-global variables, please.

Posted: Thu Jun 16, 2005 10:41 pm
by blindleaf
where do i put that code?

Posted: Thu Jun 16, 2005 10:48 pm
by Revan
blindleaf wrote:where do i put that code?
Replace it with your super-global variables.

Code: Select all

<?
  echo "<p>Order processed.";
  echo date("H:i, jS F");
  echo "<br>";
  echo "<p>Your order is as follows:";
  echo "<br>";
  echo $_POST["tireqty"]." tires<br>";
  echo $_POST["oilqty"]." bottles of oil<br>";
  echo $_POST["sparkqty"]." spark plugs<br>";
?>