Free PHP Material

PHP Tutorial for Beginners

PHP may be a powerful scripting language that matches gracefully into HTML and puts the tools for creating dynamic websites within the hands of the people — even people like me who were too lazy to find out Perl scripting and other complicated backend hoodoo.

This tutorial is for the one that understands HTML but doesn’t know much about PHP. one among PHP’s greatest attributes is that it’s a freely distributed open-source language, so there are all types of fantastic reference material about it out there, which suggests that when you understand the fundamentals, it’s easy to seek out the materials that you simply got to push your skills.
What Is PHP?
So, what's this whole PHP business all about?

PHP may be a program that gets installed on top of your web server software. It works with versions of Apache (Tutorial: Apache for Beginners), Microsoft IIS and other server software packages.

You use PHP by inserting PHP code inside the HTML that creates up your website. When a client (anybody on the web) visits an internet page that contains this code, your server executes it. That’s why you would like to put in your own server so as to check PHP locally — the server is that the brain here, not your browser. Users don’t need any special plug-ins or anything to ascertain your PHP in action — it gets to the top user as regular old-fashioned HTML.

PHP may be a scripting language, like HTML. meaning that code doesn't get to be compiled before it gets used — it gets processed on the fly as necessary.

Before we dig in, you ought to realize a site called PHP.net. PHP is an open-source language, and PHP.net is its center, with extensive reference material about the language and tips sent in by users across the world. PHP.net has exceptional, deep information about the language, but it is often a touch cryptic for the newcomer. We’ll look more closely at the way to use PHP.net at the top of this tutorial.

So, what sorts of things can PHP do? Well … it can:

take info from web-based forms and use it during a million ways (store it during a database, create conditional pages counting on what the forms said, set cookies for later, send e-mail, write your mom on her birthday);
authenticate and track users;
run threaded discussions on your site;
serve different pages to people using different browsers or devices;
publish a whole website using just one layout template (server-side includes-style);
serve XML pages.
But before we will get to the precise uses of PHP, we'd like to start out with a fast preview of the building blocks of PHP, beginning with a sample script. this instance script is titled “chickenman.php.” When called by an internet browser, it might simply read, “I am the CHICKEN MAN!”
HTML Forms and PHP
In our examples thus far, we've set variables then used all of them within the same code. This doesn’t make much sense because in those instances, we could have just hard-coded the values rather than using variables.

Let’s get some real mileage by creating HTML forms to collect user input, turning that input into variables, then doing various things with the knowledge that we just collected.

No sense in sitting around waiting – let’s plow ahead and make an internet page that collects your favorite dirty word and displays it on another page that tells you what a pervert you're. All of this provides a page that appears tons like this.

First, we make the shape page, which is regular HTML with a form in it. I’m calling mine “badwords_form.html,” but call yours whatever you wish. (If you would like an honest primer on HTML forms, read Jay’s the way to Add HTML Forms to Your Site tutorial.)
This is a daily HTML form. The important pieces are as follows:

Line 7: the HTML that reads action="bad_words.php" tells the browser which PHP document will process the results of the shape. that's to mention, during a minute you’ll create a document called “bad_words.php” which can be the small engine that creates the result page happen. (We’ll get to the method=post part afterward .)

Line 10: input type=" text" determines that the shape element which we would like here is “text” or a text box (we could even have a radio button, checkbox, etc.); name="YourName" determines that regardless of the user types into the text box will become a variable that we've called “YourName.” this is often what ties together forms and variables – each form field can set a variable to be used however you would like.

Line 13: Here you've got another text input that sets a variable called “FavoriteWord” which is that the user’s favorite dirty word.

Line 16, 17: This code makes a submit button with the text “That’s Right!” and ends the shape.

So this type will collect the unassuming user’s name and favorite bad word, but now what can we do with it? Let’s take the variables she set and echo them back in another context on another page.

On line 7 of the HTML above, we told the shape to go on over to bad_words.php once the submit button was hit. this is often what bad_words.php looks like:


avatar
Admin Welcome to Alhuda I.T, if you have anything to ask please via our WhatsApp
Alhuda I.T A.O.A there! Hello, Can I help you? In case of no responce within 30 minutes, visit https://www.alhuda.com.pk
:
Chat WhatsApp