bonjour a tous,
j'essaye de faire un header sous conditions malheuresement une erreur apparait :
Warning: Cannot modify header information - headers already sent by (output started at c:\PHP\WAMP\www\main.php:4) in c:\PHP\WAMP\www\main.php on line 18
le code utilisé est un champ de texte a remplir, si ce mot est benjamin alors on va sur benjamin.php (sauf quand ca bug)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
<?php
echo "Repertoire<br><br> ";
echo "Que souhaitez vous faire?";
?>
<form action="http://localhost/main.php" method="POST">
Quel est votre prénom?
<input type="text" name="prenom" value="">
<input type="submit" value="clik">
</form>
<?php
if($_POST["prenom"]!=""){
print("<center>Hey ".$_POST["prenom"]." you</center>");
	if($_POST["prenom"]=="benjamin"){
	echo "ndpeizfpizeph";
	header("Location : benjamin.php");
	}
 
}
?>

Merci
Ben