note 128583 added to mysqli.query
| From: | usarvesh9 at gmail dot com | Date: | Mon, 05 Jun 2023 05:06:36 +0000 |
| Subject: | note 128583 added to mysqli.query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-220540@lists.php.net to get a copy of this message | ||
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>WAASAAS Frequent Flyer Survey - Speak your Brains!</title>
</head>
<body>
<h1>WAASAAS Frequent Flyer Survey</h1>
<?php
// Define variables and set them to empty values
$firstNameErr = $lastNameErr = $flyerNumErr = "";
$firstName = $lastName = $flyerNum = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Function to validate input data
function validateInput($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
// Validate if all fields are filled
if (empty($_POST["firstName"])) {
$firstNameErr = "First name is required";
} else {
$firstName = validateInput($_POST["firstName"]);
}
if (empty($_POST["lastName"])) {
$lastNameErr = "Last name is required";
} else {
$lastName = validateInput($_POST["lastName"]);
}
if (empty($_POST["flyerNum"])) {
$flyerNumErr = "Frequent Flyer number is required";
} else {
$flyerNum = validateInput($_POST["flyerNum"]);
// Validate if the Frequent Flyer number is an 8-digit number
if (!preg_match("/^\d{8}$/", $flyerNum)) {
$flyerNumErr = "Frequent Flyer number must be an 8-digit number";
}
}
// Check if at least one checkbox is chosen
if (!isset($_POST["activities"])) {
$activitiesErr = "Please choose at least one activity";
}
}
?>
<form id="surveyForm" action="<?php echo
htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
<label for="firstName">First Name:</label>
<input type="text" id="firstName" name="firstName">
<span class="error"><?php echo $firstNameErr; ?></span>
<br><br>
<label for="lastName">Family Name:</label>
<input type="text" id="lastName" name="lastName">
<span class="error"><?php echo $lastNameErr; ?></span>
<br><br>
<label for="flyerNum">WAASAAS Frequent Flyer Number:</label>
<input type="text" id="flyerNum" name="flyerNum">
<span class="error"><?php echo $flyerNumErr; ?></span>
<br><br>
Preferred meal:
<select name="meal">
<option value="">--- Please Choose ---</option>
<option value="standard">Standard</option>
<option value="vegetarian">Vegetarian</option>
<option value="vegan">Vegan</option>
<option value="gluten-free">Gluten-free</option>
<option value="fruitarian">Fruitarian</option>
<option value="meat-lovers">Meat-lover's - no vegetables</option>
<option value="vegemite-sandwich">Vegemite sandwich</option>
</select>
<br><br>
What do you like to do during flights?<br>
<input type="checkbox" id="activity1" name="activities[]"
value="snore-loudly">
<label for="activity1">Snore loudly</label><br>
<input type="checkbox" id="activity2" name="activities[]"
value="eat-messily">
<label for="activity2">Eat messily</label><br>
<input type="checkbox" id="activity3" name="activities[]"
value="talk-to-neighbor">
<label for="activity3">Talk to the person next to you</label><br>
<input type="checkbox" id="activity4" name="activities[]"
value="complain-to-crew">
<label for="activity4">Complain to the cabin crew</label><br>
<input type="checkbox" id="activity5" name="activities[]"
value="sleep-in-aisle">
<label for="activity5">Sleep in the aisle</label><br>
<span class="error"><?php echo $activitiesErr; ?></span>
<br><br>
<input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
</body>
</html>
Above i have created a php query using a html code and data base.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.13.130 (proxied: 163.53.144.71)
----
Manual Page -- https://php.net/manual/en/mysqli.query.php
Edit -- https://main.php.net/note/edit/128583
Del: integrated -- https://main.php.net/note/delete/128583/integrated
Del: useless -- https://main.php.net/note/delete/128583/useless
Del: bad code -- https://main.php.net/note/delete/128583/bad+code
Del: spam -- https://main.php.net/note/delete/128583/spam
Del: non-english -- https://main.php.net/note/delete/128583/non-english
Del: in docs -- https://main.php.net/note/delete/128583/in+docs
Del: other reasons-- https://main.php.net/note/delete/128583
Reject -- https://main.php.net/note/reject/128583
Search -- https://main.php.net/manage/user-notes.php