Hallo,
ik heb deze code toegevoegd in mij contact-form:



<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">  



wanneer ik heb de contact form ingevulled en submit button geklikt ik krijg de home pagina en de email wordt niet verzonden.

ik zie deze uitlegging over deze code in w3school:
The $_SERVER["PHP_SELF"] is a super global variable that returns the filename of the currently executing script.

en plus deze uitlegging :

he htmlspecialchars() function converts special characters to HTML entities. This means that it will replace HTML characters like < and > with &lt; and &gt;. This prevents attackers from exploiting the code by injecting HTML or Javascript code (Cross-site Scripting attacks) in forms.

mij vraag is nu :
wat is het fout hier dat ik krijg home pagina plus mij email wordt niet verzonden?
is er een oplossing voor deze probleem ? of ik moet negeren deze code helemaal.



 action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">  


dank u wel
Ik vermoed dat je GET parameters gebruikt in je URL?
Je kan het attribuut ook gewoon leeglaten, dan verwijst hij naar de huidige URL:


action=""
maar dan zou htmlspecialchars geen invloed hebben of wel?
dank u wel
Met htmlspecialchars() maakt je schadelijke tekens, zoals XSS wel onschadelijk!
Het is veilig, maar je kan het attribuut ook gewoon leeg houden als het om dezelfde bestandsnaam gaan.
Aanvulling: als je pagina's HTML5 zijn, is het beter om het action attribuut helemaal weg te laten. Dit valideert:


<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>PHPHulp Question</title>
</head>
<body>
	<form method="post">
		<input type="text" name="email">
		<input type="submit" value="submit me">
	</form>
</body>
</html>

En dit niet:

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>PHPHulp Question</title>
</head>
<body>
	<form method="post" action="">
		<input type="text" name="email">
		<input type="submit" value="submit me">
	</form>
</body>
</html>
dank u wel .
ik wist dat action="" had helemaal geen betekenis.
dank u wel for tip

Reageren