English 中文(简体)
如何应GET的请求通过无线电塔顿?
原标题:How are radio buttons passed in a GET request?

无线电塔带如何作为参数通过? 我正在使用页: 1 Sinatra网络服务器。 我如何能够在服务器方面获得选定的无线电台的值?

传真

<form method="get" action="/register">
  <input type="radio" name="regRadio" value="1" />
  <input type="radio" name="regRadio" value="2" />
  <input type="radio" name="regRadio" value="3" />
  <input type="radio" name="regRadio" value="4" />
</form>

页: 1

get  /register  do
  params[:regRadio]??
end
最佳回答

首先,该方法应为<代码>后而不是get。 其余似乎是罚款。 对我来说,这项工作是:

require  sinatra 

get  /  do
  <<-HTML
    <form method="post" action="/register">
      <input type="radio" name="regRadio" value="1" />
      <input type="radio" name="regRadio" value="2" />
      <input type="radio" name="regRadio" value="3" />
      <input type="radio" name="regRadio" value="4" />
      <input type="submit" value="Register"/>
    </form>
  HTML
end

post  /register  do
  "You selected #{params[:regRadio]}"
end

当你选择第三个项目并打上“登记”

“form”/

您将取得以下成果:

“result”/

如果不为你工作,问题就在其他地方。 在这种情况下,请向我们介绍你的实际守则。

问题回答

这只是笼统的指针,因为它是http://www.un.org。

该数值按“Radio”的名称计算。 由于这两个无线电台都拥有价值1,如果不设定价值1或1。 因此,应当如此。 2. 结 论





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签