mirror of
https://github.com/FranP-code/Frist-actual-form.git
synced 2025-10-12 23:53:02 +00:00
El codigo de HTML fue trasladado a un nuervo archivo PHP. Fue un quilombo
This commit is contained in:
@@ -4,8 +4,10 @@ echo print_r($_POST);
|
||||
|
||||
if (!isset($_POST['sumbit'])) {
|
||||
header ('Location: index.html');
|
||||
};
|
||||
}
|
||||
|
||||
$name = $_POST;
|
||||
echo 'hola';
|
||||
|
||||
$name = $_POST['name'];
|
||||
|
||||
?>
|
||||
50
formulario.php
Normal file
50
formulario.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
if (isset($_POST['submit'])) {
|
||||
$name = $_POST['name'];
|
||||
$email = $_POST['electronic-mail'];
|
||||
|
||||
if (!empty($name)) {
|
||||
$name = filter_var($name, FILTER_SANITIZE_STRING)
|
||||
|
||||
}
|
||||
|
||||
if (!empty($email)) {
|
||||
$email = filter_var($email, FILTER_SANITIZE_EMAIL)
|
||||
|
||||
if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function badWords ($v) {
|
||||
$badWords = ['fuck', 'prick', 'bastard', 'bellend', 'ass', 'cunt', 'balls', 'shit']
|
||||
// Source = https://www.fluentin3months.com/dirty-words/
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Formulario</title>
|
||||
<link rel="stylesheet" href="./styles.css">
|
||||
</head>
|
||||
<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">
|
||||
</form>
|
||||
</div>
|
||||
<h2><?php echo 'Tu nombre es: ' . $name;?></h2>
|
||||
</body>
|
||||
</html>
|
||||
20
index.html
20
index.html
@@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Formulario</title>
|
||||
<link rel="stylesheet" href="./styles.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="form-container">
|
||||
<form action="backEnd.php" method="POST" class="form">
|
||||
<input type="text" placeholder="Name" name="name" required class="name">
|
||||
<input type="email" placeholder="E-mail" name="electronic-mail" required class="email">
|
||||
<textarea placeholder="Message" name="message" required minlength="35" class="message"></textarea>
|
||||
<input type="submit" value="Send" name="submit" required class="submit">
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user