将下拉列表“选择值”传递到 URL

Passing Drop down Select Value to URL

本文关键字:URL 选择值 下拉列表 选择      更新时间:2023-09-26
<select id="langu" name="langu">
    <option value="English">English</option>
    <option value="Chinese">中国的</option>
    <option value="Korean">한국의</option>
    <option value="Vietnamese">Việt</option>
</select>

以上是 .基于 PHP,基于用户所做的选择,我想将选择的值作为表单操作URL的一部分传递:

<form name="frmLang" 
action="index2.php?r=<?php echo $rguid;?>&l=[THE DROPDOWN OPTION HERE];?>" 
method="post">

首先,这可能吗? 如果是这样,如何将该变量传递到 URL 中而不必转到另一个页面? Javascript? (不能使用 AJAX(。

谢谢

H.

method="post"更改为method="get",并将$rguid作为隐藏输入包含在内:

<form name="frmLang" action="index2.php" method="get">
  <input type="hidden" name="r" value="<?php echo $rguid; ?>">
  <select id="langu" name="l">
        .
        .
        .