Learn PHP Tutorial 31 Get checkbox value using PHP

Pubblicato il: 08 gennaio 2016
sul canale di: Champion Mahipal
7,640
26

This video is made for learning about Get checkbox value using PHP in PHP.

Dealing with Forms

One of the most powerful features of PHP is the way it handles HTML forms. The basic concept that is important to understand is that any form element will automatically be available to your PHP scripts.

The HTML Form

Before you can process the information, you need to create an HTML form that will send information to your PHP script. There are two methods for sending data: POST and GET. These two types of sending information are defined in your HTML form element's method attribute. Also, you must specify the location of the PHP file that will process the information.

Next, we are going to create our PHP file that will process the data. When you submit your HTML form PHP automatically populates two superglobal arrays, $_GET and $_POST, with all the values sent as GET or POST data, respectively. Therefore, a form input called 'Name' that was sent via POST, would be stored as $_POST['Name'].

$_GET is an array of variables passed to the current script via the URL parameters.

$_POST is an array of variables passed to the current script via the HTTP POST method.

When to use GET?
Information sent from a form with the GET method is visible to everyone (all variable names and values are displayed in the URL). GET also has limits on the amount of information to send. The limitation is about 2000 characters. However, because the variables are displayed in the URL, it is possible to bookmark the page. This can be useful in some cases.

GET may be used for sending non-sensitive data.

Note: GET should NEVER be used for sending passwords or other sensitive information!

When to use POST?
Information sent from a form with the POST method is invisible to others (all names/values are embedded within the body of the HTTP request) and has no limits on the amount of information to send.

To get value of multiple checked checkboxes, name attribute in HTML input type=”checkbox” tag must be initialize with an array, to do this write [ ] at the end of it’s name attribute


In questa pagina del sito puoi guardare il video online Learn PHP Tutorial 31 Get checkbox value using PHP della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Champion Mahipal 08 gennaio 2016, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 7,640 volte e gli è piaciuto 26 spettatori. Buona visione!