Jump to content

Recommended Posts

I am a beginning to learn PHP as a hobby.  The wealth of tutorials and examples on the web has been at best a mixed blessing.  I go to one site that tells me to use super globals, and the next tells me to never use them, instead to rely on session variables.  Just now I spent some time looking for information on creating a simple login script, and found so many different ideas, all claming to be "simple" and are completely out of my league.  Some sites talk about needing to validate form input, but fall short of giving any real information as to accomplishing this.

 

So what is a novice programmer supposed to do?  I seem to have a very difficult time sifting through everything to even get started.

 

Advice?

Link to comment
https://forums.phpfreaks.com/topic/51253-lost-within-too-much-contradiction/
Share on other sites

Ok I think the best way to learn is to code stuff and try it out :)

 

Basically Ive been programming PHP for 3 years and I find Session variables much better than globals. When someone says "Validate form info", that normally means check to see if the user is doing what they are supposed to do. For instance:

 

if(!$_POST['username']){
      echo "You need to enter a username!";
} elseif(!$_POST['password']){
      echo "You need to enter a password!";
} else {
      //Login Stuff here
}

You want to rely on globals and session values as little as possible.  The best advice would be to stop pissing around with tutorials and spend $25-40 on a decent book.  There's a book thread somewhere in these forums; use the search feature.

just buy a few books. Some people are better at explaining different things and some books focus on different areas, thats why I suggest multiple books.

 

There is sooo much wrong with tutorials, in short tutorials are one of two things.

1. not written by experts and can mislead beginners in various ways

2. written for beginners and as a result usually avoid going into some areas that in my opinion would make it easier for beginners to grasp.

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.