Code has been added to clipboard!
Error Messages in PHP Required Field
Example
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<input type="text" name="fullname" placeholder="Full name">
<span>*<?php echo $fullname_error;?></span><br>
<input type="text" name="email" placeholder="E-mail">
<span>*<?php echo $email_error;?></span><br>
<input type="text" name="website" placeholder="Website URL">
<span><?php echo $website_error;?></span><br>
<textarea name="feedback" rows="6" cols="50" placeholder="Feedback"></textarea><br><br>
<input type="radio" name="gender" value="f">F
<input type="radio" name="gender" value="m">M
<span>*<?php echo $gender_error;?></span><br><br>
<input type="submit" name="submit" value="Submit">
</form>