Category: php

.

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

<form action="test.php" method="post"> First Name: <input type="text" name="first_name" /> Last Name: <input type="text" name="last_name" /> <input type="submit" name="submit" /> </form>

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.

Author: D.Shaun Morgan

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

passing data from one form to another form php Passing data from one form to another form To pass php data from a form and then catch that data into another form one way to accomplish this task is to intermi

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

store images mysql php php Storing Images in Mysql Database Tutorial Outline: Creating a Test Mysql Database Example php Database Functio

php example post array php Visual example of how PHP handles the super-global array variable "$_POST" Author: D.Shaun Morgan Versions and Skill Level

.
 

Leave a Comment

how_to_write_html_form_PHP.php

Name:      | Email:      | Website:

Comment:


captcha

Enter The Above Security Code:


Author: nidhi | Website URL: |
Comment:
how can we attach the html content while sending mail in php
Re: Admin
not sure what your are asking. Are you asking about attachments?