-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path11_sanitaze_inputs.php
More file actions
33 lines (30 loc) · 865 Bytes
/
11_sanitaze_inputs.php
File metadata and controls
33 lines (30 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
* SECURITY INPUTS
*/
if (isset($_POST['submit'])) {
//Eng: 1a option: || Pt: 1a opcao
// $name = htmlspecialchars($_POST['name']);
// $age = htmlspecialchars($_POST['age']);
//Eng: 2a option: || Pt: 2a opcao
$name = filter_input(INPUT_POST, 'name', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$age = filter_input(INPUT_POST, 'age', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
echo $name;
echo $age;
}
?>
<!--HTML-->
<!--Form-->
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<div>
<label for="name">Name: </label><input type="text" name="name" required></input>
</div>
<div>
<labelb for="age">age: </label><input type="number" name="age" required></input>
</div>
<div>
<input type="submit" value="submit" name="submit">
</div>
</form>
<!--link-->
<!--end HTML-->