• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Simple PHP problem

 
Ranch Hand
Posts: 750
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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??
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
guy this book is old, try another one like the "PHP 5 Power Programming" .
 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .
reply
    Bookmark Topic Watch Topic
  • New Topic