简体   繁体   English

如何保存html表单输入数据?

[英]How can I save html form input data?

I want to store the data I inserted into this html form on the server side. 我想将我插入到此html表单中的数据存储在服务器端。 And afterwards I want to be able to access this data and use it in a Raspberry Pi project. 然后我希望能够访问这些数据并在Raspberry Pi项目中使用它。 How can I do that? 我怎样才能做到这一点?

<div class='alertBox' id='box'>
            <p id='displayDate'></p> <br>
            <form>
                <input name='Event' type='text' placeholder=' Event'> <br>
                <input type='submit' name='save' value='save'>
            </form> <br>
            <a onclick='unpop()' class='close'>Close</a> 
        </div>

You can use MySQL to store the data. 您可以使用MySQL来存储数据。 And afterwards, you can fetch the data again. 然后,您可以再次获取数据。

Like this: 像这样:

$sqlInsert = 'INSERT INTO table_name (All, the, column, names) VALUES (the, inserted, values)';

Fetching: 取:

SELECT * 
FROM table_name 
WHERE a_column_name = user_input

If you're new to PHP / MYSQL, you could view / store the users input using $_POST[]; 如果您是PHP / MYSQL的新手,可以使用$ _POST []查看/存储用户输入; superglobal. 超全局。

Like this: 像这样:

<?php
$input = $_POST['Event'];
?>
<form method="post">
    <input name='Event' value="<?php if(isset($_POST['save'] { echo $input; } ?>" type='text' placeholder=' Event'> <br>
    <input type='submit' name='save' value='save'>
</form>

More information: https://www.w3schools.com/php7/php7_forms.asp 更多信息: https//www.w3schools.com/php7/php7_forms.asp

I hope this helps ;) 我希望这有帮助 ;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 是否可以将来自popup.html的输入数据保存在localStorage中? - Can I save input data from popup.html in localStorage? 如何使用html保存数据 - how can I save data using html 如何访问 html 表单中的输入表单结果? - How can I access the input form results in an html form? 如何对用户以 html 形式输入的数据应用字符串化? - How can i apply stringify on the data which has been input by the user in an html form? 我可以在 html 表单输入字段中显示我的文本文件数据吗? 如果是,请告诉我怎么做? - can i display my text file data in html form input field? if yes, please tell me how? 我无法保存输入(HTML 和 JS) - I can't save a input (HTML and JS) 我可以从HTML表单中读取输入并将其保存在TXT文件中的特定位置吗? - Can I read the input from a HTML form and save it at at a specific position in TXT file? 我可以使用 JAVASCRIPT/jQuery 将表单中的输入保存到 HTML 中的 .txt,然后使用它吗? - Can I save input from form to .txt in HTML, using JAVASCRIPT/jQuery, and then use it? 如何通过输入表单将对象数组添加到html列表? - How can I add array of object to html list by input form? 如何使用 javascript 索引来自 HTML 表单的输入? - How can I use javascript to index input from a HTML form?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM