I have a page to create a new user. I have a php script that does various checks on the data entered in text fields. When it finds non-conforming entries, I need to provide feedback to the user to state why the process has been terminated. My thought was to simply have an empty div that I would populate with a message specific to the failing condition.
However, it looks like this might be more difficult than I had thought. I'd prefer to to this in my php script. I'm pretty new to web development. I'm open to suggestions about the best / easiest way to accomplish this. Thanks.
<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();
}
?>