note 125481 added to tutorial.forms

From: Date: Sun, 01 Nov 2020 16:00:57 +0000
Subject: note 125481 added to tutorial.forms
Groups: php.notes 
Request: Send a blank email to php-notes+get-215682@lists.php.net to get a copy of this message
An HTML form on a web page is nothing more than a convenient user-friendly way to configure an HTTP request to send data to a server. This enables the user to provide information to be delivered in the HTTP request. Use the PHP program for the backend to check form submission and HTML, CSS to create the form as frontend. Use these two statements to check whether the form submitted successfully or not: <?php if (!empty($_POST)) { } if (isset($_POST['submit'])) { } ?> <form action="process.php" method="POST"> <input type="text" name="my Name"> <input type="submit" name="submit" value="Submit"> </form> process.php <?php print_r($_POST); ?> Here, name="my Name" contains 5 spaces and the output will be: Array ( [my_____Name] => Md Moniruzzaman ) So, PHP has generated an underscore character for each space. <?php echo 'My name is ' . $_POST['my_____Name']; echo 'My name is ' . $_POST['my Name']; //Undefined index: my Name ?> ---- Server IP: 45.112.84.4 Probable Submitter: 185.85.3.174 (proxied: 37.111.227.51) ---- Manual Page -- http://php.net/manual/en/tutorial.forms.php Edit -- https://master.php.net/note/edit/125481 Del: integrated -- https://master.php.net/note/delete/125481/integrated Del: useless -- https://master.php.net/note/delete/125481/useless Del: bad code -- https://master.php.net/note/delete/125481/bad+code Del: spam -- https://master.php.net/note/delete/125481/spam Del: non-english -- https://master.php.net/note/delete/125481/non-english Del: in docs -- https://master.php.net/note/delete/125481/in+docs Del: other reasons-- https://master.php.net/note/delete/125481 Reject -- https://master.php.net/note/reject/125481 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#215682) next »