从下拉列表中保存该值 [英] Saving the value from a drop-down list
本文介绍了从下拉列表中保存该值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的情况,我有2页,一个用于选择一个值,另一个用于编辑与该值相关的数据库相关的东西。
Here's my situation, I have 2 pages, one for selecting a value and one for editing database related things which are associated to that value.
现在,我对于如何将从下拉列表中选择的值保存到来自PHP的变量中,没有任何知识(并且已经研究了一些)。
Right now, I have no knowledge ( and have researched a fair bit ) on how to save the value selected from the drop down list into a variable from PHP.
任何想法?
推荐答案
它的两个步骤:
第一个html:
Its two step: First html:
<form action='databasethings.php' method=post>
<select name="myvalue">
<option value="value1">Value 1</option>
<option value="value2">Value 2</option>
<option value="value3">Value 3</option>
</select>
<input type=submit>
</form>
用于将值发送到databasethings.php脚本(
Its for sending the value to databasethings.php script.(
然后在databasethings.php中:
Then in databasethings.php:
$myvalue=$_POST['myvalue'];
//do something with myvalue
这会将值1,2或3从html中捕获到$ myvalue中php
This will catch value1, 2 or 3 from html into $myvalue in php
这篇关于从下拉列表中保存该值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文