mirror of
https://github.com/FranP-code/Frist-actual-form.git
synced 2025-10-12 23:53:02 +00:00
Proyecto formulario concluido pero no terminado
This commit is contained in:
@@ -1,36 +1,33 @@
|
||||
<?php
|
||||
|
||||
$error = ['Name not placed', 'Email not placed', 'Message not placed', 'Bad word founded in '];
|
||||
|
||||
$error = ['Name not placed', 'Email not valid', 'Message not placed', 'Bad word founded in '];
|
||||
$name = null;
|
||||
$email = null;
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['electronic-mail'];
|
||||
|
||||
}
|
||||
if (!empty($name)) {
|
||||
$name = trim($name);
|
||||
$name = filter_var($name, FILTER_SANITIZE_STRING);
|
||||
|
||||
} if (!empty($name)) {
|
||||
// if (badWords($name) == true) {
|
||||
// echo $error[3] . 'name';
|
||||
|
||||
// } else {
|
||||
// echo $name;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
if (!empty($email)) {
|
||||
$email = filter_var($email, FILTER_SANITIZE_EMAIL);
|
||||
|
||||
if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// } if (!empty($name)) {
|
||||
// // if (badWords($name) == true) {
|
||||
// // echo $error[3] . 'name';
|
||||
|
||||
// // } else {
|
||||
// // echo $name;
|
||||
// // }
|
||||
|
||||
// }
|
||||
|
||||
// function badWords ($v) {
|
||||
// $badWords = ['fuck', 'prick', 'bastard', 'bellend', 'ass', 'cunt', 'balls', 'shit'];
|
||||
// // Source = https://www.fluentin3months.com/dirty-words/
|
||||
@@ -62,12 +59,27 @@ if (isset($_POST['submit'])) {
|
||||
<body>
|
||||
<div class="form-container">
|
||||
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method="POST" class="form">
|
||||
<input type="text" placeholder="Name" name="name" class="name">
|
||||
<input type="email" placeholder="E-mail" name="electronic-mail" class="email">
|
||||
<textarea placeholder="Message" name="message" minlength="35" class="message"></textarea>
|
||||
<input type="submit" value="Send" name="submit" class="submit">
|
||||
<input type="text" placeholder="Name" name="name" class="name" id="name">
|
||||
<input type="text" placeholder="E-mail" name="electronic-mail" class="email" id="email">
|
||||
<textarea placeholder="Message" name="message" minlength="35" class="message" id="message"></textarea>
|
||||
<input type="submit" value="Send" name="submit" class="submit" id="submit">
|
||||
</form>
|
||||
</div>
|
||||
<h2><?php echo 'Tu nombre es: ' . $name;?></h2>
|
||||
<?php if ($name != null) { if(!empty($name)) {
|
||||
|
||||
echo '<div class="error-name"><h2 class="error-name">Tu nombre es: ' . $name . '</div></h2>';
|
||||
|
||||
} }?>
|
||||
|
||||
<h2 class="error-email"><?php
|
||||
if ($email != null) {
|
||||
if(filter_var($email, FILTER_VALIDATE_EMAIL)){
|
||||
echo '<div class="error-email">Your email is: ' . $email . '</div>';
|
||||
|
||||
} else {
|
||||
echo 'Email not valid';
|
||||
}
|
||||
}
|
||||
?></h2>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
10
styles.css
10
styles.css
@@ -25,7 +25,7 @@
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-size: 14pt;
|
||||
margin-top: 2px;
|
||||
color:#4d5761
|
||||
color:#4d5761;
|
||||
}
|
||||
|
||||
.message {
|
||||
@@ -51,4 +51,10 @@
|
||||
|
||||
body {
|
||||
background-color: #0e93ff50;
|
||||
}
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
color: #ff0e0e;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user