Jump to content

New to Php - Variable not returning a value?


karl09
Go to solution Solved by 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

Link to comment
Share on other sites

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>";
Edited by Ch0cu3r
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.