When learning PHP to build a website, one of the very first things that any newcomer, or beginner needs to learn is how to use HTML or XHTML (both will mean the same for this tutorial.) forms to collect information from users. Those data are usually email addresses, names, birthdays, and sometimes private information like credit card info, SSN, and home addresses. (The scripts in this tutorial are not meant for processing security sensitive data. It is only intended to teach you how to use forms with PHP variables, and get that information from the server into your script.) Just in case you are not very familiar with HTML forms, we will start with a quick beginner's how-to with forms.
In the HTML form below, I will collect a user's first and last name
Here is an explanation, top to bottom, of the various functions performed by the above HTML attributes.
Form - Method – When I submit my form to the server, method tells the server how to handle the information that was just collected. In this case I used post. This means that PHP will send variables to the server in what is called a (super-global.array) You will later access these variables to use them on another page. Arrays and super-global-arrays will be covered later in this tutorial.
Form - Action – Tells the server to which script to send form data to for handling.
Input – Input has two attributes that I used for this lesson. type is to tell Internet browsers what to display. In this instance it will be a text field. The value entered for name will actually become a string of text I will use to retrieve that particular bit of data from the PHP Super Global Array $_POST['first_name']. Finally, the submit button. This simply places a button image on the web page for clicking. When the submit button is clicked, all the information in my form is sent to the server.
using php cookies variables
Using Cookie Variables in PHP
Setting cookies in php is pretty straight forward. There is a php function:
This function mu
how to unzip files on your free hosting account Uzipping Files on Your Web Server
If you are using a free hosting account with godaddy.com and many of the other Free hosts out there, you may have found that they don't offer you a lot o
notepad plus Notepad++
Download Notepad Plus Plus
Notepad plus plus is an open source, free text editor. It is
how to open create write files php Php file functions, Opening a file in php, reading a file in php, writing a file in php
In this tutorial we will look at the most commonly used file functions used in php. The
register globals long arrays php Security, php.ini, register_globals and register_long_arrays
Author: D.Shaun Morgan
Versions and Skill Level
PHP Version - PHP 5x