[英]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.