Files
WMU-CS4430-Project/var/www/search.php

51 lines
1.1 KiB
PHP

<!DOCTYPE html>
<html>
<body>
<style>
body {
background-color: #3B5998;
}
</style>
<h2><font color="white">Who would you like to search for</h2>
<?php
$name = $message = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["name"])) {
$name = "";
} else {
$comment = test_input($_POST["name"]);
}
if (empty($_POST["Message"])) {
$message = "";
} else {
$message = test_input($_POST["message"]);
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
Which Search:
<input type="radio" name="type" <?php if (isset($type) && $gender=="name") echo "checked";?> value="type">Name
<input type="radio" name="type" <?php if (isset($type) && $gender=="username") echo "checked";?> value="type">Username
<br><br>
Search Key: <br><input type="text" name="name" value="<?php echo $name;?>">
<br><br>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>