+ -
当前位置:首页 → 问答吧 → 请教一个form里action的问题。

请教一个form里action的问题。

时间:2011-09-23

来源:互联网

HTML code

<form method="post" id="form" action="index.php" name="theform">
<input type="hidden" name="action" value="all" />
<input type="submit" name="submit" value="提交" onclick="this.form.action+='?op=del';">
</form>





这样写是不是有问题?

我这样写的话,提交不到index.php?op=del这里,只能提交到index.php里。
是不是form里不能有一个name为action的表单?因为他们有冲突?

解决方法是不是只有修改
<input type="hidden" name="action" value="all" />
这里的name值。

作者: wcunw   发布时间: 2011-09-23

index.php?op=del与index.php是指同一个页面。。

你在index.php 页面可根据op参数的不同来进行不同的操作。

作者: jordan102   发布时间: 2011-09-23

一个是get方式一个是post方式

作者: kyzy_yy_pm   发布时间: 2011-09-23

form 的action是index.php

你的提交的按钮式type = “submit”;实际上点击后会走action的。
你直接把form的action改为index.php?op=del就行啊。
或者是这种形式index.php?op=<?=$action;?>

作者: ohmygirl   发布时间: 2011-09-23

我想说的是你对form表单都不清楚,你应该把这写基础东西弄明白了再说

作者: hb214   发布时间: 2011-09-23

this.form.action 是错的 写成document.getElementById('form').action='';

作者: yhkyo   发布时间: 2011-09-23