For example, there is a textarea element, the user enters a message there, and using PHP, you need to write this data into a variable in order to transfer it further to the database. How can I do that?
- read php.net/manual/ru/language.variables.external.php - splash58
|
1 answer
Create a form, and then accept using the post.
Html:
<form action="action-url.php" method="post"> <textarea name="text"></textarea> <button type="submit">Отправить</button> </form> PHP:
<?php if (isset($_POST['text'])) { // код обработки } ?> - Besides GET / POST, what options are there? I see some flaws in this method. - Eugene Johnson
- Only if you use AJAX - Stepan
- @ Stepan and ayaks not get-post uses what? :) - teran
- 2@EugeneJohnson what could be the flaws in
GET/POSTif these are the main two HTTP protocol requests? "Method" is a frame through a form, and the type of request is a means. So what do you see flaws in the form or type of request? GET, by the way, is usually not used to change data, which even follows from its name. - teran - @teran already got goosebumps, got to his tears)) - Jean-Claude
|