I am new to php. I am currently learning php from a book called "Beginning PHP4" from wrox publications. I am copying the code exactly from the book and I am getting this weird error. I would appreciate if someone could please shed some light into this.
There are two pages, car.html and car.php. The first page 'car.html' has a form and sends some value to 'car.php' and does some calculations and displays the result.
car.html
Code: Select all
<html>
<body>
<div align="center">
<b>Car Rental Services</b><br><br>
<form method=POST action="car.php">
First Name:- <Input name="firstname" type="text"> <br><br>
Age:- <Input name="age" type="text"> <br><br>
Do you hold a valid California License:-
<Input name="license" type="checkbox"> <br><br>
<Input type="Submit">
<Input type="Reset">
</form>
</div>
</body>
</html>Code: Select all
<html>
<body>
<div align="center">
<b>Car Rental Company</b> <br><br>
<?php
if ( $age > 20 && $license =="on" )
echo ("You can rent the car<br><br>");
if ( $age < 21 || $license =="" )
echo ("Sorry, You are denied");
?>
<br><br>
<a href="car.html>click here</a>
</div>
</body>
</html>Car Rental Company
Notice: Undefined variable: license in C:\Xitami\webpages\car.php on line 11
Notice: Undefined variable: license in C:\Xitami\webpages\car.php on line 15
Sorry, You are denied
I would appreciate if someone could shed some light into this.
I am using Xitami Web Server + PHP4.2 + MySQL 3.23 + WinXP Pro
I am at the point where I need to fix this. Until now, I have been ignoring such errors since I knew that the code was Ok.
my c:\windows\php.ini settings are "cgi.force_redirect = 0" & register_globals = On
Thank You,
Pistolfire99