<form method=post> <input type="hidden" name=name value="<?= $_POST['name'] ?>"> <input type="submit"> </form> I do not understand what the value attribute will pass
I do not understa...">
<form method=post> <input type="hidden" name=name value="<?= $_POST['name'] ?>"> <input type="submit"> </form> I do not understand what the value attribute will pass
because the hidden field, in this case it will always be empty if it is not filled on the browser side with some script.
I'll try to tell you how it works ...
Judging by the absence on the action form, the data will be sent to the same page. Therefore, we obtain the following algorithm:
$_POST superglobal array. And since you are trying to get missing data, you will probably get a warning about this from PHP. In general, when you try to display the contents of a non-existent variable, you get an empty string.$_POST['name'] is empty for us, the value of the element will be empty.method="POST" ), and on the server side, the $_POST array will no longer be empty, but will contain data from the form, i.e. $_POST['name'] will be equal to what was entered in the input.$_POST['name'] , i.e. what was entered before submitting this form.In fact, you are not transmitting anything (judging by the code that you provided). This is a meaningless form which conveys the value of what is contained in the $_POST['name'] array, that is, the same thing that was passed earlier.
Source: https://ru.stackoverflow.com/questions/304698/
All Articles
valuewill contain the contents of the$_POST['name']cell, if it is not empty and exists. - Opalosolo