文本
pyhon 后端用request.values.get("name") 去获取
- if request.method == "POST":
- username = request.values.get("username")
- sex = request.values.get("sex")
二、多选按钮checkbox
- <div class="row">
- <div class="col-sm-2 ">
- <label>
- <input name="s_option" value="basketball" type="checkbox"> 篮球
- </label>
- </div>
- <div class="col-sm-2 ">
- <label>
- <input name="s_option" value="football" type="checkbox"> 足球
- </label>
- </div>
- <div class="col-sm-2 ">
- <label>
- <input name="s_option" value="badminton" type="checkbox"> 羽毛球
- </label>
- </div>
- </div>
后端使用request.values.getlist("s_option") 去获取,获取的value会组成一个列表
- s_option = request.values.getlist("s_option")
- for s in s_option:
- pass
三、select 下拉框
前端表现形式
- <select class="form-control" name="manufacturer" id="manufacturer">
- <option></option>
- <option selected="selected">--请选择厂家--</option>
- <option >HP</option>
- <option >Huawei</option>
- <option >Inspur</option>
- </select>
pyhon 后端也是用request.values.get("name") 去获取