我在下面的代码中没有发现任何错误。但是,在提交表格时,一切都没有发生。具体来说,我的页面没有重定向到其他页面。我正在使用WAMP服务器上的CodeIgniter在本地测试此代码。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Register New</title>
</head>
<body>
<?php $attributes = array('AUTOCOMPLETE' => 'off','method' =>'post');?>
<?=form_open('welcome/register',$attributes);?>
<table align="center" border="0">
<th>
<td colspan="3" >
<font color="#0033FF" title="" face="Times New Roman, Times, serif" size="+1">Register New</font>
</td>
</th>
<tr>
<td colspan="4" align="center" style="color:#FF0000; font-size:14px">
<?php
$vmsg=$this->session->userdata('msg');
if($vmsg)
echo $vmsg;
$this->session->unset_userdata('msg');?><?=validation_errors();
?>
</td>
</tr>
<tr>
<td>User Name: </td>
<td><div align="center" style="font:Geneva, Arial, Helvetica, sans-serif; color:#FF0000; font-size:14px;">*</div></td>
<td><input type="text" name="user_name" id="user_name" /></td>
</tr>
<tr>
<td>Designation: </td>
<td><div align="center" style="font:Geneva, Arial, Helvetica, sans-serif; color:#FF0000; font-size:14px;">*</div></td>
<td><input type="text" name="desig" id="desig" /></td>
</tr>
<tr>
<td>Phone No.: </td>
<td><div align="center" style="font:Geneva, Arial, Helvetica, sans-serif; color:#FF0000; font-size:14px;">*</div></td>
<td><input type="text" name="ph_no" id="ph_no" /></td>
</tr>
<tr>
<td>Login ID:</td>
<td><div align="center" style="font:Geneva, Arial, Helvetica, sans-serif; color:#FF0000; font-size:14px;">*</div></td>
<td><input type="text" name="login_id" id="login_id" /></td>
</tr>
<tr>
<td>Password:</td>
<td><div align="center" style="font:Geneva, Arial, Helvetica, sans-serif; color:#FF0000; font-size:14px;">*</div></td>
<td><input type="password" name="pwd" id="pwd" /></td>
</tr>
<tr>
<td>Retype Password:</td>
<td><div align="center" style="font:Geneva, Arial, Helvetica, sans-serif; color:#FF0000; font-size:14px;">*</div></td>
<td><input type="password" name="re_pwd" id="re_pwd" /></td>
</tr>
<tr>
<td colspan="3" align="right">
<input type="submit" name="btnsubmit" value="Save" />
</td>
</tr>
</table>
</form>
</body>
</html>
注意PHP代码中的form_open
指令。
如何修复表单提交流程?
答案 0 :(得分:2)
好吧,看来您的表单甚至没有包含在<form>
标记中,这是一个开始。
答案 1 :(得分:1)
您没有空缺<form method="">
来关闭</form>
在实际表单上方添加此内容。示例:
<form method="POST">
<tr><td>User Name: </td>
<td><div align="center" style="font:Geneva, Arial, Helvetica, sans-serif; color:#FF0000; font-size:14px;">*</div></td>