-3

Help me find the error in gender.

<!DOCTYPE html>

<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>

<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<table >
<tr>
<td>Name</td>
<td><input type="text" name="name"/></td>
</tr>
<tr>
<td>E-mail</td>
<td><input type="email" name="email"/></td>
</tr>
<tr>
<td>Website</td>;
<td><input type="text" name="website"/></td>
</tr>
<tr>
<td>Comment</td>
<td><textarea resize="none" name="comment" rows="5" cols="50"></textarea> </td>
</tr>
<tr>
<td>Gender</td>
<td> <input type="radio" name="gender" value="female">Female
<input type="radio" name="gender" value="male">Male</td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Submit"/></td>
</tr>
</table>
</form>
<?php $name = $email =  $comment = $website = ""; $gender="";
$errname = $erremail= $errweb = $errcomment= $errgender= "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = test_input($_POST["name"]);
$email = test_input($_POST["email"]);
$website = test_input($_POST["website"]);
$comment = test_input($_POST["comment"]);
$gender= test_input($_POST["gender"]);

echo $name;echo "<br>";echo $email;echo "<br>";echo $website;echo "<br>";echo $comment;echo "<br>";echo $gender;                }

function test\_input($data){$data = trim($data);$data = stripslashes($data);$data = htmlspecialchars($data);return $data;             }

?>

</body>
</html>

Comments
  • 6
    No. Bye.
  • 3
    Get Lost you idiot
  • 8
    Firstly, this is the wrong place for this, you're better of going on Stackoverflow, asking colleagues/classmates/friends.
    Secondly, you _should_ try asking question the smart way (your post makes me wonder if you had an error and went straight to here instead of trying things yourself, including looking up the error and solutions).
    Lastly, do you _seriously_ think pasting code here like this will be helpful? Instead of getting it highlighted or posting a JsFiddle/CodePen/... URL?

    If you want help, you at least should:
    - show you've done the research and put efforts in trying to solve the problem yourself and mention what you tried,
    - show what exactly is wrong (hint: saying something along the lines of "I got an error" won't help anyone),
    - and make it easy for others to help you.

    I would have gladly helped you if I could, but I can see you haven't made any efforts in what is possibly highlighted by your editor or 1-2 searches away.
  • 3
    Why do you ask for peoples gender
  • 5
    Sure, I charge $100 an hour.
  • 0
    @junon wow, you are cheap.
  • 0
    duplicate question
Add Comment