• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple PHP problem

 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I'm using the book...PHP for the world wide web

In chapter 3 there are two scripts, form.html and HandleForm.php shown below:






But when I run it and enter data, I get this..


Your first name is .
Your last name is .
Your E-mail address is .
This is what you had to say:


For some reason the $name is just blank.
My web hosting uses PHP5, and the book is for PHP 3 and 4, but I doubt thats why.

Can anyone help??
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either the book is wrong or you're missing a step. If you post a form in PHP, you have to get the values from the $_POST variable like so...



Not sure what they are doing in the code you've posted.
 
colin shuker
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, yes thats right, apparently its a security thing new to PHP5.

So you use GET for get requests, and POST for post requests.
I hope my 2 php books aren't too outdated with regards to other bits of code.
 
Rafael Monteiro Dourado
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guy this book is old, try another one like the "PHP 5 Power Programming" .
 
Matthew Brown
Bartender
Posts: 4567
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The feature is called "Register Globals". In old versions of PHP what you're doing was allowed by default, but in PHP 4.2 it was disabled by default for security reasons. And in PHP5 it's officially deprecated. Don't use it .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic