2010-04-19 25 views
-2

我有这个html表单,然后它会调用addstuds.php来执行在mysql数据库中插入记录的代码。如何调用一个html表单

<form name="formcheck" method="post" action="addstuds.php"> 
<td width="30" height="35"><font size="3">*I D Number:</td> 
<td width="30"><input name="idnum" onkeypress="return isNumberKey(event)" type="text" maxlength="5" id='numbers'/></td> 
</tr> 

<tr> 
<td width="30" height="35"><font size="3">*Year:</td> 
<td width="30"><input name="yr" onkeypress="return isNumberKey(event)" type="text" maxlength="5" id='numbers'/></td> 

<td width="30" height="35"><font size="3">Section:</td> 
<td width="30"><input name="sec" type="text" maxlength="15"></td> 
</tr> 

什么我需要做的,这样的regstuds.php(HTML表单)将是将再次在addstuds.php插入代码后,可以看到将完成执行吗?请帮

回答

0

您可以在regstuds.php顶部的addstuds.php中包含表单处理代码,并使用$ _SERVER ['PHP_SELF']让表单操作返回到regstuds.php。

至于成功的消息,你可以设置一个标志,如果添加成功,并回显脚本标记,如果该标志为真。

1

您可以在执行后执行includerequire文件。

或者,你可以做一个好的'ol HTTP重定向:header('Location: regstuds.php');。 只有重定向的问题在于,如果您已经将任何头文件发送回客户端,那么在发送完头文件之后就不能对其进行修改。但是,当然,也有一个解决方案:使用JavaScript:window.location = "regstuds.php";将做到这一点。

+0

谢谢,这是好的,但我不能看到确认,我把addstuds.php了: 回声“”; – user225269 2010-04-19 07:24:15

相关问题