Jump to content

New to Php - Variable not returning a value?


karl09

Recommended Posts

Hi Guys

 

Im new to php and i am currently working my way through a book i found called, "php and mysql web development". It seems a good book, however the code for the first exercise is not working for me. The book comes with the code snippets on a disc but even these do not run when i try. Could someone pls take a look as i have no idea, i have tried to find the answer over the last 2days. Thankyou in advance for any help.orderform.htmlprocessorder.php

I have a feeling this book is out of date.

	echo $tireqty." tires<br>";
	echo $oilqty." bottles of oil<br>";
	echo $sparkqy." spark plugs<br>";

The above is the old way of getting data from a form that has been submitted. This will only work if a setting called register_global is enabled. This setting has been removed as of php5.4. 

 

You should find a book that is using this version at least, a book published in 2012 should be more up to date.

 

The correct code would be to use the $_POST super global instead

	echo $_POST['tireqty']." tires<br>";
	echo $_POST['oilqty']." bottles of oil<br>";
	echo $_POST['sparkqty']." spark plugs<br>";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.