Skip to content

Instantly share code, notes, and snippets.

@simoebenhida
Created March 16, 2019 14:39
Show Gist options
  • Save simoebenhida/9396eaa474a9f9098ded6d7d76c0826c to your computer and use it in GitHub Desktop.
Save simoebenhida/9396eaa474a9f9098ded6d7d76c0826c to your computer and use it in GitHub Desktop.
<?php
if(
!empty($_POST)
&& !empty($_POST['firstName'])
&& ! empty($_POST['lastName'])
&& ! empty($_POST['message'])
) {
echo "Your Form has been successfully Sent!";
}
?>
<form style="display: flex;flex-direction: column;width:400px" action="" method="POST">
<div style="margin-bottom: 10px">
<input type="text" name="firstName" placeholder="first name" value="<?php echo $_POST['firstName'] ?? ''; ?>">
<?php
if(! empty($_POST) && empty($_POST['firstName'])) {
echo "</br><span style='color:red;font-style:italic'>first Name is required!</span>";
}
?>
</div>
<div style="margin-bottom: 10px">
<input type="text" name="lastName" placeholder="last name" value="<?php echo $_POST['lastName'] ?? ''; ?>">
<?php
if(! empty($_POST) && empty($_POST['lastName'])) {
echo "</br><span style='color:red;font-style:italic'>last Name is required!</span>";
}
?>
</div>
<div style="margin-bottom: 10px">
<textarea name="message" id="" cols="30" rows="10" placeholder="Message"><?php echo $_POST['message'] ?? ''; ?></textarea>
<?php
if(! empty($_POST) && empty($_POST['message'])) {
echo "</br><span style='color:red;font-style:italic'>Message is required!</span>";
}
?>
</div>
<button style="padding-top: 10px;padding-bottom: 10px" type="submit">Send !</button>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment