Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/255.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用select box表单方法get时如何获取链接url?_Php - Fatal编程技术网

Php 使用select box表单方法get时如何获取链接url?

Php 使用select box表单方法get时如何获取链接url?,php,Php,我有一个示例代码: <form action="index.php" method="get"> <select name="id"> <option value="1">One</option> <option value="2">Two</option> </select> <input type="submit" value="submit" name="submit" /> <

我有一个示例代码:

<form action="index.php" method="get">
<select name="id">
   <option value="1">One</option>
   <option value="2">Two</option>
</select>
<input type="submit" value="submit" name="submit" />
</form>

一个
两个
当我提交表单时,url是“
index.php?id=1
”//或
index.php?id=2


=>如何修复它是result“
index.php?id=1&name=One
”//或者
index.php?id=2&name=Two

我认为最好的方法是从数据库填充选项。将这些值用作db ID号。然后,您可以为每个选项存储任意数量的信息。例如:

//some sort of loop{
<option value="
<?php echo $row_option['id'];?>">
<?php echo $row_option['display_text'];?></option> 
}
//某种循环{
}

在另一端用值查询数据库;使用该值所需的任何数据。

是否有理由同时需要
ID
name
?@RobB:我想创建一个链接seoprety,确定它无法实现提问者的要求。