Probleme de formulaire (formmail.php)

Résolu/Fermé
mathieu_n Messages postés 65 Date d'inscription vendredi 13 mars 2009 Statut Membre Dernière intervention 19 février 2024 - 2 janv. 2012 à 09:20
mathieu_n Messages postés 65 Date d'inscription vendredi 13 mars 2009 Statut Membre Dernière intervention 19 février 2024 - 2 janv. 2012 à 13:46
Bonjour,


Je n'arrive pas à faire fonctionner mon formulaire sur mon site internet.

J'utilise donc le formulaire suivant a l'intérieur de la page "formulaire.html"


<form method="post" action="formmail.php">

<!-- <input name="subject" value="formmail" type="hidden" /> -->


Nom
:     <input name="Nom" value="" type="text" /> <span style="color: rgb(255, 0, 0);">*</span><br />

Prénom : <input name="Prenom" value="" type="text" /> <br />

code postal: <input name="code" value="" type="text" /><br />

adresse mail: <input name="mail" value="" type="text" />
<span style="color: rgb(255, 0, 0);">*</span><br />

<br />

Dans le cas d'une commande, vous souhaitez :<br />

<input name="exp" type="radio" />que
la commande vous soit expédiée<br />

<input name="exp" type="radio" /> venir
récupérer votre commande à Ambazac (87)<br />

<br />

<p>Ecrivez vos questions ou votre commande :<br />

<textarea name="commande" rows="8" cols="55">texte
</textarea></p>

<p><input value="Envoyer" type="submit" />  </p>

</form>






Afin de pouvoir recevoir le contenu sur mon adresse mail, j'utilise le fichier (formmail.php)


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title></title>
</head>
<body>



<?php
$TO = "test@bouillette-maison.fr ";

$h = "From: " . $TO;

$message = "";

while (list($key, $val) = each($HTTP_POST_VARS)) {
$message .= "$key : $val\n";
}

mail($TO, $subject, $message, $h);

Header("Location: http://www.bouillette-maison.fr");

?>

</body>
</html>



Une fois tout ceci en ligne, un message d'erreur apparait (erreur 405).
Merci de bien vouloir m'eclairer

5 réponses

Alain_42 Messages postés 5361 Date d'inscription dimanche 3 février 2008 Statut Membre Dernière intervention 13 février 2017 894
2 janv. 2012 à 09:36
il manque des choses:

<form method="post" action="formmail.php">

<!-- <input name="subject" value="formmail" type="hidden" /> -->


Nom
:     <input name="Nom" value="" type="text" /> <span style="color: rgb(255, 0, 0);">*</span><br />

Prénom : <input name="Prenom" value="" type="text" /> <br />

code postal: <input name="code" value="" type="text" /><br />

adresse mail: <input name="mail" value="" type="text" />
<span style="color: rgb(255, 0, 0);">*</span><br />

<br />

Dans le cas d'une commande, vous souhaitez :<br />

<input name="exp" type="radio" value="Cde expédiée" />que
la commande vous soit expédiée<br />

<input name="exp" type="radio"  value="Cde recuperee Ambazac"  /> venir
récupérer votre commande à Ambazac (87)<br />

<br />

<p>Ecrivez vos questions ou votre commande :<br />

<textarea name="commande" rows="8" cols="55">texte
</textarea></p>

<p><input value="Envoyer" type="submit" name="envoyer "/>  </p>

</form>


formmail.php

<?php
$TO = "test@bouillette-maison.fr ";

$h = "From: " . $TO;
$h .='Content-Type: text/plain; charset="iso-8859-1"'."\n";
$h .='Content-Transfer-Encoding: 8bit'; 
$message = "";
$subject= "Commande"; //il manque le sujet !

while (list($key, $val) = each($_POST)) {
$message .= "$key : $val\n";
}
//test si bien envoyé
if(mail($TO, $subject, $message, $h)){

	Header("Location: merci.html"); //renvoi vers la page merci

}else{

	echo "pb d'envoi du mail";
}



?>


merci.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>

<title></title>
</head>
<body>



Merci votre commande nous a bien été envoyée.

<br /><br />
<a href="http://www.bouillette-maison.fr">retour au site bouillette-maison.fr</a>

</body>
</html> 
0
mathieu_n Messages postés 65 Date d'inscription vendredi 13 mars 2009 Statut Membre Dernière intervention 19 février 2024 14
2 janv. 2012 à 11:40
Merci beaucoup Alain_42 pour votre réponse rapide.
Malheureusement, je viens de faire les changements et j'ai toujours le même message d'erreur sur mon navigateur:


The page cannot be displayed
The page you are looking for cannot be displayed because an invalid method (HTTP verb) was used to attempt access.

Please try the following:

Contact the Web site administrator if you believe that this request should be allowed.
Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.

HTTP Error 405 - The HTTP verb used to access this page is not allowed.
Internet Information Services (IIS)

Technical Information (for support personnel)

Go to Microsoft Product Support Services and perform a title search for the words HTTP and 405.
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Setting Application Mappings, Securing Your Site with Web Site Permissions, and About Custom Error Messages.
0
Alain_42 Messages postés 5361 Date d'inscription dimanche 3 février 2008 Statut Membre Dernière intervention 13 février 2017 894
2 janv. 2012 à 12:06
0
mathieu_n Messages postés 65 Date d'inscription vendredi 13 mars 2009 Statut Membre Dernière intervention 19 février 2024 14
2 janv. 2012 à 12:35
merci beaucoup

je vais voir tout ca et te tiens au courant
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
mathieu_n Messages postés 65 Date d'inscription vendredi 13 mars 2009 Statut Membre Dernière intervention 19 février 2024 14
2 janv. 2012 à 13:46
Merci beaucoup pour votre aide.
Je viens de contacter mon hébergeur, il y avait un problème au niveau de la gestion du php. Ceci devrait etre resolu rapidement.
bonne journée
0