I'm actually learning PHP but I found this error while running
Parse error: syntax error, unexpected 'if' (T_IF) in C:\xampp\htdocs\lols.php on line 13
Can't see my error ¿Would you like to help me?
<!DOCTYPE HTML>
<html>
<head>
<title>PHP</title>
</head>
<body>
<?php
$name = $email = $gender = ""
if ($_SERVER["REQUEST_METHOD"] == "POST"){
$name = testdata($_POST["name"]);
$email = testdata($_POST["email"]);
$gender = testdata($_POST["gender"]);
}
function testdata($data){
$data = trim($data);
$data = stripcslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>">
Name: <input type="text" name="name">
E-mail: <input type="text" name="email">
Gender: <input type="radio" name="gender" value="male"> male
<input type="radio" name="gender" value="female"> female
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>