Answer the question
In order to leave comments, you need to log in
Why is the form not being submitted using the POST method?
There are two pages: index.php and form.php. On the first (index.php) form, on the second page the data that we entered into the form should be displayed.
Code:
index.php
<form method="post" action="form.php">
<input type="text" name="username" />
<input type="submit" id="send" name="submit" value="Отправить" />
</form>
<?php
echo $_POST['username'];
?>
Answer the question
In order to leave comments, you need to log in
Are you sure that the first file is index.php and is it written correctly? In form.php you specify an opening <?php tag and a closing tag, but in index.php you have no tags. In this case, it should be the index.html file. Or you are not giving the full text of the first index.php file. Or if you want it to be php and interpreted correctly, then it should be
index.php
<?php
echo '<form method="post" action="form.php">
<input type="text" name="username" />
<input type="submit" id="send" name="submit" value="Отправить" />
</form>';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question