两个按钮一个窗体
Two buttons one form
<?=form_open('blog/register');?>
<table>
<tr>
<td><label for="register_name">Username : </label></td>
<td><input type="text" name="register_name" readonly="readonly" value="<?=$_POST['username']?>"/></td>
</tr>
<tr>
<td><label for="register_email">Email:</label></td>
<td><input type="text" name="register_email" readonly="readonly" value="<?=$_POST['email']?>"/></td>
</tr>
<tr>
<td><label for="register_password">Password:</label></td>
<td><input type="password" name="register_password" readonly="readonly" value="<?=$_POST['password']?>"/></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Register" onclick="return true;"/></td>
</tr>
<tr>
<td></td>
<td>
<input type="button" value="Edit" onclick="window.location.replace('http://localhost/index.php?username='<?=$_POST['username']?>'&email='<?=$_POST['email']?>');return true;"/>
</td>
</tr>
</table>
<?=form_close()?>
这是带有两个按钮作为两个选项的表单,"注册"按钮用于将用户重定向到注册屏幕,而第二个按钮会将用户定向到登录屏幕。它不起作用,有人可以给我一个提示或任何说明吗?
我单击第二个按钮,没有任何反应。第一个按钮工作正常
尝试替换
<input type="button" value="Edit" onclick="window.location.replace('http://localhost/index.php?username='<?=$_POST['username']?>'&email='<?=$_POST['email']?>');return true;"/>
跟
<input type="button" value="Edit" onclick="window.location.href = 'http://localhost/index.php?username=<?=$_POST['username']?>&email=<?=$_POST['email']?>';return true;"/>
我相信你有一些引号混淆了。
为了澄清,我删除了 php 周围的单引号,因为我认为它们不是必需的,并在您不想要的地方切断了您的位置字符串。代码生成的位置字符串为 'http://localhost/index.php?username='
,这是不正确的。
更新
将replace()
更改为href
替换代码
<input type="button" value="Edit" onclick="window.location.replace('http://localhost/index.php?username='<?=$_POST['username']?>'&email='<?=$_POST['email']?>');return true;"/>
跟
<input type="button" value="Edit" onclick="window.location.replace('http://localhost/index.php?username=<?=$_POST['username']?>&email=<?=$_POST['email']?>');return true;"/>
相关文章:
- 仅为一个窗体运行应用程序脚本
- 在一个窗体中处理具有相同名称和值的多个按钮
- Createjs DomElement创建一个窗体
- 禁用基于rails中另一个字段的字段窗体
- CRM-从另一个窗体检索选定的选项集
- Asp.Net 将多个窗体添加到一个窗体时,用户控件无法正常工作
- 未捕获的类型错误: $(..).文档窗体不是一个函数
- 如何在一个窗体上创建子网格并将其值传递给另一个窗体中的查找
- 制作另一个窗体,该窗体将显示列表(自动完成)并将用作所选字段的值
- 常规按钮和提交按钮在一个窗体don'不起作用
- 两个按钮一个窗体
- 当另一个窗体有焦点时,禁用其中一个窗体
- 我怎么能显示一个窗体(从小枝渲染),当我点击btn
- 从另一个窗体到另一个窗体禁用按钮的问题
- Symfony -在一个窗体中添加多个窗体
- 在另一个窗体上自动更改单选选项
- 试图使一个dojo小部件,将创建一个窗体
- 打开一个窗体,点击一个按钮,禁用背景
- 隐藏一个窗体并使用按钮显示另一个窗体
- 无法仅在实体的一个窗体上显示自定义功能区按钮