note 125481 deleted from tutorial.forms by cmb
| From: | cmb@php.net | Date: | Sun, 01 Nov 2020 16:37:20 +0000 |
| Subject: | note 125481 deleted from tutorial.forms by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215683@lists.php.net to get a copy of this message | ||
Note Submitter: Md Moniruzzaman Natore
----
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
?>