From the course: PHP for Web Designers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Getting form input sent by the POST method

Getting form input sent by the POST method - PHP Tutorial

From the course: PHP for Web Designers

Start my 1-month free trial

Getting form input sent by the POST method

HTML has all the elements needed to build an online form. But it's not capable of processing the data once the form has been submitted. For that, you need to use a server side language such as PHP. The aim of this chapter is to build an auto-confirmation page for the Hansel and Petal website. But before embarking on that script, you need to know how to retrieve the data submitted by a form. This page contains a simple web form with a text input field, a number input field, a select menu, a submit button and a hidden field. The opening form tag, the method attribute is set to post which means the data will be transmitted to the server in the http headers when the form is submitted for processing. The opening form tag in this page, doesn't have an action attribute, which means the page will simply reload, when the submit button is clicked. So we'll use that, to inspect the data, that is sent by the form. When the server receives a request for a page, PHP automatically creates an array…

Contents