首页 > 解决方案 > 如何将html表值获取到主程序

问题描述

一个例子会更好地理解我的场景。

<select name="Country" >
<option value="0"> Japan <option>
<option value="1"> Koria <option>
</select>


<table name="expense">
  <tr>
    <th>Month</th>
    <th>Savings</th>
  </tr>
  <tr>
    <td>January</td>
    <td>100</td>
  </tr>
  <tr>
    <td>February</td>
    <td>80</td>
  </tr>
</table>

<select>r.FormValue("Country")可以使用表单提交从主程序中检索标签的值。它将根据所选选项返回 0 或 1。

但是我怎样才能得到表值呢?

此屏幕截图有助于解释这种情况。 在此处输入图像描述

标签: go

解决方案


为了从表单提交中获取表值:

您可能需要以某种方式使它们成为输入值:

 <td>
     <input type="text"  name="color_1" value="" />
 </td>

不确定这样做的目的:可以在请求参数中访问输入值。


推荐阅读