Help me find the error in gender.

<!DOCTYPE html>

<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<table >
<td><input type="text" name="name"/></td>
<td><input type="email" name="email"/></td>
<td><input type="text" name="website"/></td>
<td><textarea resize="none" name="comment" rows="5" cols="50"></textarea> </td>
<td> <input type="radio" name="gender" value="female">Female
<input type="radio" name="gender" value="male">Male</td>
<td><input type="submit" name="submit" value="Submit"/></td>
<?php $name = $email =  $comment = $website = ""; $gender="";
$errname = $erremail= $errweb = $errcomment= $errgender= "";
$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;             }



  • 7
    No. Bye.
  • 4
    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
    inb4 the one joke
  • 0
    duplicate question
Add Comment