Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 11th, 2005, 05:45 PM
Registered User
Join Date: Nov 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Code not working well

Hi Everyone,

I've just gotten Beginning PHP 4 book and need some help. I tried running the code they have on Page 120 and it does'nt quite work too well on IE.

The HTML file works just fine, but the .php file does'nt return anything. Thank you.

PHP version : 4.3.4
Browser: IE

Here is the code for car.html and car.php
<B>Namlu Car Rentals</B>
First Name:
Last Name:
<TEXTAREA NAME ="Address" ROWS="4" COLS="40">
"Do you hold currently a driving license?"
<INPUT NAME="License" TYPE="Checkbox">


if ($Age>20 && $License=="on") echo ("Good to go");
if ($Age>21 && $License=="") echo ("Sorry.. ");

Old November 11th, 2005, 06:54 PM
Authorized User
Join Date: Oct 2003
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts


The short answer is try your php code like this:


if ($_POST['Age']>20 && $_POST['License']=="on") echo ("Good to go");
if ($_POST['Age']>21 && $_POST['License']=="") echo ("Sorry.. ");

As a variable POSTed from the form is accessed as $_POST['whatever'], and to extract it from an url use the get method $_GET['whatever'], there is lot of explanations why, do a google search from doing a search using keywords: "register_globals" or search the forums here for reasoning behind it.

Old November 11th, 2005, 08:02 PM
Registered User
Join Date: Nov 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Thank you very much for this.

It works just fine.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Working Code - Ch15 slurp56 BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 3 April 24th, 2013 10:32 AM
Code not working billytikky88 C# 1 February 17th, 2008 03:20 PM
Select From Where Code not working...help bidatad Access VBA 2 April 1st, 2005 03:25 PM
Working with code behind - How To pinkuisadear ASP.NET 1.0 and 1.1 Basics 7 March 11th, 2005 01:13 AM
code not working Toka1 Javascript How-To 12 December 17th, 2003 05:08 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.