새 사용자를 만들 페이지가 있습니다. 텍스트 필드에 입력 된 데이터에 대한 다양한 검사를 수행하는 PHP 스크립트가 있습니다. 부적합한 항목을 발견하면 프로세스가 종료 된 이유를 설명하기 위해 사용자에게 피드백을 제공해야합니다. 내 생각에는 실패한 조건에 해당하는 메시지로 채울 빈 div가 생겼다.PHP에서 if 문을 기반으로 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();
}
?>