每个表单的每个Radibutton或所有单选按钮的1个表单? [英] Each Radiobutton for each form or 1 Form for all radiobuttons?
问题描述
我在这个主页上遇到了问题。
我必须创建一个这样的网站:
status创建工作完成
Item1 * oo
Item2 o * o
Item3 oo *
(* =已勾选,o =未勾选)
现在作为管理员,我有权改变每个项目的状态。
例如,当我将状态从Item1更改为work时,它应该发送一个Form并将其更新到Database中。
我的问题是知道的,我应该为每对3个单选按钮创建1个表单吗?
但是当我创建1所有按钮我都会有问题知道哪些状态发生了变化。
仅与每个数据库条目进行比较。
在有人问我之前,我应该使用单选按钮。
希望有人可以帮忙。
Greetz
恶魔
编辑:对不起,eomeone误解了我。
我的意思是如果我会更快更好:
< form method =post>
Item 1< input type =radioname =item1value =createonclick =this.form.submit()/>
< input type =radioname =item1value =workonclick =this.form.submit()/>
< input type =radioname =item1value =finishedonclick =this.form.submit()/>
< / form>
< form method =post>
Item 2< input type =radioname =item2value =createonclick =this.form.submit()/>
< input type =radioname =item2value =workonclick =this.form.submit()/>
< input type =radioname =item2value =finishedonclick =this.form.submit()/>
< / form>
或
< form method =post>
Item 1< input type =radioname =item1value =createonclick =this.form.submit()/>
< input type =radioname =item1value =workonclick =this.form.submit()/>
< input type =radioname =item1value =finishedonclick =this.form.submit()/>
Item 2< input type =radioname =item2value =createonclick =this.form.submit()/>
< input type =radioname =item2value =workonclick =this.form.submit()/>
< input type =radioname =item2value =finishedonclick =this.form.submit()/>
< / form>
因为PHP / MySQL的性能
我可能会使用一个表单,然后为所有值执行数据库更新。
然后我会使用javascript来扩充页面,即保留它为不支持/执行javascript但具有仅发送已执行javascript的客户端中已更改的值的提交处理程序的客户端工作。
然后,我会执行一些基准测试/分析以检查如果仅更改值版本确实比更新所有值版本更快/更好。如果不是javascript部分是历史; - )
i have a problem with this homepage.
I have to create a Site like this:
status create work finished
Item1 * o o
Item2 o * o
Item3 o o *
(* = checked, o = unchecked)
Now as admin i have the rights to change the status of the each Item.
For example when i change the Status from Item1 to "work" it should send a Form and update it in Database.
My Problem is know, should i create for each pair of 3 radiobuttons 1 Form?
But when i create 1 for all Buttons i will have problems to know which status have changed.
Only compare with each Database entry.
Before someone ask, i should use radiobuttons. Hope someone could help.
Greetz
Demonking
Edit: Sorry, eomeone have misunderstand me. I meant if i would be faster and better with :
<form method="post">
Item 1 <input type="radio" name="item1" value="create" onclick="this.form.submit()"/>
<input type="radio" name="item1" value="work" onclick="this.form.submit()"/>
<input type="radio" name="item1" value="finished" onclick="this.form.submit()"/>
</form>
<form method="post">
Item 2 <input type="radio" name="item2" value="create" onclick="this.form.submit()"/>
<input type="radio" name="item2" value="work" onclick="this.form.submit()"/>
<input type="radio" name="item2" value="finished" onclick="this.form.submit()"/>
</form>
or
<form method="post">
Item 1 <input type="radio" name="item1" value="create" onclick="this.form.submit()"/>
<input type="radio" name="item1" value="work" onclick="this.form.submit()"/>
<input type="radio" name="item1" value="finished" onclick="this.form.submit()"/>
Item 2 <input type="radio" name="item2" value="create" onclick="this.form.submit()"/>
<input type="radio" name="item2" value="work" onclick="this.form.submit()"/>
<input type="radio" name="item2" value="finished" onclick="this.form.submit()"/>
</form>
because of Performance with PHP/MySQL
I'd probably use one form and then perform a database update for all values.
And then I'd use javascript to augment the page, i.e. keep it working for clients that don't support/execute javascript but have a submit-handler that only sends values that have changed in clients that do execute javascript.
And then I'd do some benchmarking/profiling to check if the "only changed values" versionn really is faster/better than the "update all values" version. If not the javascript part is history ;-)
这篇关于每个表单的每个Radibutton或所有单选按钮的1个表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!