<form action="CK" method="post"> <input type="checkbox" name="CK1" Value="1">跑步 <input type="checkbox" name="CK2" Value="2">游泳 <input type="checkbox" name="CK3" Value="3">爬山 <input type="checkbox" name="CK4" Value="4">打球 <p></p> <input type="submit" value="提交"> </form>
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject; Request: TWebRequest; Response: TWebResponse; var Handled: Boolean); var i:integer; s:string; begin for I := 0 to Request.ContentFields.Count -1 do begin //S := S + '; ' + Request.ContentFields.Values[Request.ContentFields.Names[i]]; case strtoint(Request.ContentFields.Values[Request.ContentFields.Names[i]]) of 1: S := S + '跑步; '; 2: S := S + '游泳; '; 3: S := S + '爬山; '; 4: S := S + '打球; '; end; end; // S := Request.ContentFields.Text; //CK1=1 CK3=3 Response.ContentType := 'text/html; charset="UTF-8"'; Response.Content := S; Handled:=true; end;标签:选择,checkbox,end,Handled,Request,webBroker,ContentFields,Response From: https://www.cnblogs.com/tulater/p/18636692