【发布时间】:2013-06-28 20:44:45
【问题描述】:
我有一个创建新用户的页面。我有一个 php 脚本,它对文本字段中输入的数据进行各种检查。当它发现不符合的条目时,我需要向用户提供反馈,以说明进程终止的原因。我的想法是简单地有一个空的 div,我将使用特定于失败条件的消息填充它。
但是,看起来这可能比我想象的要困难。我宁愿在我的 php 脚本中这样做。我对网络开发很陌生。我愿意接受有关实现此目标的最佳/最简单方法的建议。谢谢。
<div id="page">
<img id="mainpic" src="images/banner.png" height="390" width="982">
<div id="stylized" class="leftsidebox"></div>
<div id="stylized" class="myform">
<form id="form" name="form" method="post" action="scripts/create_admin.php">
<label>Security Code
<span class="small">Enter the security code provided to you</span>
</label>
<input type="text" name="securitycode" id="name" />
<button type="submit">Create Administrator</button>
</form>
</div>
<div id="stylized" class="rightsidebox">
<div id="stylized" class="feedback">
<h1>this is where I want to add dynamic text from php</h1>
</div>
</div>
</div>
<?php
include('connection.php');
//retrieve input values from the form
$security_code = $_REQUEST['securitycode'];
if (strlen($security_code) == 0) {
//Add the text "Please enter a security code." to the div class="feedback"
die();
}
?>
【问题讨论】:
标签: php html web-applications