Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- מעל תגית HTML
- <?php
- if (empty($_POST) == false){
- $errors = array();
- $name = $_POST['name'];
- $email = $_POST['email'];
- $message = $_POST['message'];
- if (empty($name) == true || empty($email) == true || empty($message) == true) {
- $errors[] = '! נא למלא את כל השדות';
- } else {
- if (filter_var($email, FILTER_VALIDATE_EMAIL) == false) {
- $errors[] = '! האימייל אינו חוקי';
- }
- if (ctype_alpha($name) == false) {
- $errors[] = '! השם חייב להכיל רק אותיות';
- }
- }
- if (empty($errors) == true) {
- mail('ilaibens14@gmail.com', 'contact form', $message, 'Form: ' . $email);
- header('Location: index.php?sent');
- exit();
- }
- }
- ?>
- הטופס:
- <div class="col-md-6 col-sm-12">
- <?php
- if (isset($_GET['sent']) == true) {
- echo '<p>! תודה לך על ההודעה, נשתדל לענות במהרה</p>';
- } else {
- if (empty($errors) == false) {
- echo '<ul>';
- foreach($errors as $error) {
- echo '<li>', $error, '</li>';
- }
- echo '</ul>';
- }
- ?>
- <form method="post" action="" class="wow fadeInUp" data-wow-delay="0.6s">
- <div class="col-md-6 col-sm-6">
- <input type="text" class="form-control" placeholder="Name" name="name" <?php if (isset($_POST['name']) == true) { echo 'value="', strip_tags($_POST['name']), '"'; } ?> >
- </div>
- <div class="col-md-6 col-sm-6">
- <input type="email" class="form-control" placeholder="Email" name="email" <?php if (isset($_POST['email']) == true) { echo 'value="', strip_tags($_POST['email']), '"'; } ?> >
- </div>
- <div class="col-md-12 col-sm-12">
- <textarea class="form-control" placeholder="Message" rows="7" name="message"><?php if (isset($_POST['message']) == true) { echo strip_tags($_POST['message']); } ?></textarea>
- </div>
- <div class="col-md-offset-4 col-md-8 col-sm-offset-4 col-sm-8">
- <input type="submit" class="form-control" value="SEND MESSAGE">
- </div>
- </form>
- <?php
- }
- ?>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement