=: This character is used to assign the name of the form field element to its data value as a name/value pair.&: This character is used to concatenate the name/value pairs together as one long query string.Each Value is assigned to its corresponding element’s name attribute value. firstValue, secondValue: These are the inputted values you entered before submitting the form.Each is assigned to its corresponding form field data, and it is used as the access key by the server script (PHP), to retrieve its data value when you fill out the form and submit it. name1, name2: Specifies the form field element’s name attribute value.When it is omitted, the browser won’t understand how to handle and send the query string (name/values pairs) to the server. ?: This character specifies where the query string for the requested page starts from.It is the page the browser is requesting from the server. The browser implement this method by concatenating the question mark character (?) to the end of the page request since it specifies where the query string (name/values pairs) starts from, and all the form data is visible to everyone as it is displayed in the browser address bar.Įxample: How the form GET method data is submitted This method instructs the browser to send the encoded information (the name/value pairs) through the URL parameter by appending it to the page request. How send worksĬlient browsers can send information to a web server in two different ways: name1=firstValue&name2=secondValue&name3=thirdValueĪlso, if the form data to be sent contains the space character, the scheme replaces it with the plus character (+), and every other non-word characters present is encoded differently. However, if the form data to be sent consists of different pairs, the ampersand character (&) is used to separate them. This scheme parses and encodes the form data as a name/value pairs, and it uses the equal sign (=) to concatenate the name/value pairs together. When you submit the form to the server, it encodes it by using a scheme called URL encoding which has a built-in pattern that describes how the form data is parsed and encoded. This means you can’t access that element form data value after the form has been submitted to the server because its key is undefined. Without the name attribute specified for each element contained in the form, PHP will be unable to create an array automatically with an access key by using the element’s name attribute value. The element’s name attribute ( name=”unique-name-here” ) value is used by PHP as key to enable access to the data value of the specified form field element when you submit the form. Setting access keys for the form data by using the element’s name attribute Note: By default, if no method is specified, the GET method is used. Method Attributes: specifies what type of method the form will use to send the data. If no script file location is specified, the browser submits the form by using the current PHP script file location ( the self-script in which the form is being called ). These two form attributes are:Īction Attributes: specifies the PHP script file location for processing when it is submitted. To set up a form for server processing and data retrieval, two important form attributes that controls how the form data is processed whenever it is submitted must be specified. In this tutorial, we’re going to walk you through on how to access or retrieve form data with PHP, and show you the different methods that can be used. or any of the many programming languages of choice.HTML form data can be retrieved and processed in many different ways, for example
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |