Bonjour,
Etant novice en programmation, j'aurais besoin d'aide. Je viens de créer un formulaire en html dont voici le code :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Mes suggestions d'achat</title>
<script type="text/javascript">
<!--
function MM_validateForm() { //v4.0
if (document.getElementById){
var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
} }
function MM_callJS(jsStr) { //v2.0
return eval(jsStr)
}
</script>
</head>
<body>
<TABLE align=center>
<TBODY>
<tr>
<td align="middle">
<DIV class=contactform>
<form action="suggestion_achat.asp" method="post" enctype="multipart/form-data" name="suggestion" id="suggestion" lang="fr" xml:lang="fr">
<fieldset>
<table style="BACKGROUND-COLOR: rgb(201,201,202); COLOR: rgb(201,201,202)" cellspacing="0" cellpadding="5" width="520">
<tbody>
<tr>
<td class="left" width="150"><label><span style="font-family:arial; font-size:11; color:black;"><b>Nom</b></span></label> </td>
<td class="right"><input name="Nom" type="text" id="txtnom" value="" class="field" /></td></tr>
</tbody>
<tr>
<td class="left" width="150"><label><span style="font-family:arial; font-size:11; color:black;"><b>Prénom</b></span></label> </td>
<td class="right"><input name="Prénom" type="text" id="txtprenom" value="" class="field" /></td></tr>
<tr>
<td class="left" width="150"><label><span style="font-family:arial; font-size:11; color:black;"><b>E-mail</b></span></label> </td>
<td class="right"><input name="E-mail" type="text" value="" id="txtemail" class="field"/></td></tr>
<tr>
<td class="left" width="150"><label><span style="font-family:arial; font-size:11; color:black;"><b>Titre</b></span></label> </td>
<td class="right"><input name="Titre" type="text" value="" id="titre" class="field"/></td></tr>
<tr>
<td class="left" width="150"><label><span style="font-family:arial; font-size:11; color:black;"><b>Auteur</b></span></label> </td>
<td class="right"><input name="Auteur" type="text" id="auteur" value="" class="field" /></td></tr>
<tr>
<td class="left" valign="top" width="150"><label><span style="font-family:arial; font-size:11; color:black;"><b>Commentaires</b></span></label> </td>
<td class="right"><textarea name="Commentaires" cols="35" rows="10" id="txtcommentaires" value="" class="field"></textarea></td></tr>
<tr>
<td class="left" width="150"> </td>
<td class="right"><input name="Submit" type="submit" onclick="MM_validateForm('txtnom','','R','txtprenom','','R','txtemail','','RisEmail','titre','','R','auteur','','R');return document.MM_returnValue" value="Envoyer" />
<input name="Submit" type="reset" value="Réinitialiser" /></td></tr>
<tr>
<td></TBODY></td></tr></table>
</fieldset>
</form></td></tr>
</body>
</html>
Et j'ai créé aussi le fichier suggestion.asp qui traite les données :
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<%
' envoi du message
Response.Codepage = 65001
Response.Charset = "utf-8"
'THE MAIL OBJECT
Dim ObjMail
Set ObjMail = Server.CreateObject("CDO.Message")
ObjMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
ObjMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "gmail-smtp-in.l.google.com"
ObjMail.Configuration.Fields.Update
objMail.From = request.form("txtemail")
objMail.To = "suggestionachat.bmi@gmail.com"
objMail.Subject = "Suggestions d'achat"
objMail.HTMLBody = "Nom: " & request.form("txtnom") & "<br />"_
& VBCrLf & "Prénom: " & request.form("txtprenom") & "<br />"_
& VBCrLf & "Email: " & request.form("txtemail") & "<br />"_
& VBCrLf & "Sujet: " & request.form("txtsujet") & "<br />"_
& VBCrLf & "Titre: " & request.form("titre") & "<br />"_
& VBCrLf & "Auteur: " & request.form("auteur") & "<br />"_
& CBCrLf & "<i>Commentaires: " &request.form("txtcommentaires") & "</i><br />"
objMail.Send
Set objMail = Nothing
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<div>
<div>
<h1 class="gris">Mes suggestions d'achat :
confirmation<br>
</h1>
<br>
Vos suggestions d'achat ont bien été prises en compte.
<br>
</div>
</div>
</body>
</html>
Je souhaiterais savoir si mon fichier en asp est correct ? Si non, pouvez-vous m'aider à le corriger ?
Merci d'avance.