I've written a form in html(uses Java) that creates a mail (html) via a php file.

For me everyting works fine, but when certain users click the send button, the form blinks and empty all fields. But other users get a confirmation mail. How is this possible?

In a way I think it has something to do with the e.g. firewall, because in my php-file I send a copy to the user.

I've attached the generator file (bestellijst.php).

Please advice,
Best regards from Belgium!

Looking at your script.
There are a few minor edits to prevent some php warning and errors.

First, $header starts off as

$header .= "From: $naam <$mailadres>\r\n";

try changing it to

$header  = "From: $naam <$mailadres>\r\n";

I am not seeing how the script fetches the variabels for the email. I am surprises all emails are not having empty values.

Is this the only php script used to send the email? If so, where is the code that sets the variables being used in the email?

Looking at the script, I would have to say maybe the security_code is failing somehow. Without seeing the complete scritps together it is a little difficult for me to help. Perhaps someone else may be of more help than me.

I'm sorry, I couldn't attached the other file (html is not being accepted as attachment). So I've pasted it below:

<HTML lang=nl>

<HEAD> 
<base target="_self">
	<TITLE> DogsCare </TITLE>

<link rel="stylesheet" type="text/css" href="main.css">
<script language="JavaScript" src="gen_validatorv31.js" type="text/javascript"></script>

</HEAD>

<BODY bgproperties=fixed bgcolor="#CCCCCC">

<script LANGUAGE="JavaScript">
<!--
function calcTotal() {
var pens_val;
var vlees_val;
var prijs_pens_val;
var prijs_vlees_val;
var totaal_val;

if(theForm.pensaantal.value>=30) 
{
		prijs_pens_val=1.25;
		lbl_pens.innerText='zakjes van 500 gram x EUR 1,25 = ';
	} else {
		prijs_pens_val=1.4;
		lbl_pens.innerText='zakjes van 500 gram x EUR 1,40 = ';
} 

if(theForm.vleesaantal.value>=30) 
{
		prijs_vlees_val=1.25;
		lbl_vlees.innerText='zakjes van 500 gram x EUR 1,25 = ';
	} else {
		prijs_vlees_val=1.4;
		lbl_vlees.innerText='zakjes van 500 gram x EUR 1,40 = ';
} 

// AHV
pens_val = theForm.pensaantal.value * prijs_pens_val;
vlees_val = theForm.vleesaantal.value * prijs_vlees_val;

pens_val = pens_val.toFixed(2); 
vlees_val= vlees_val.toFixed(2); 

theForm.penstotaal.value = pens_val;
theForm.vleestotaal.value = vlees_val;

// LamRijst
var prijs_lam2_val;
var prijs_lam5_val;
var prijs_lam10_val;
var prijs_lam15_val;
var lam2_val;
var lam5_val;
var lam10_val;
var lam15_val;

prijs_lam2_val=11.25;
prijs_lam5_val=22.5;
prijs_lam10_val=36.5;
prijs_lam15_val=55;

lam2_val=theForm.lam2aantal.value*prijs_lam2_val;
lam5_val=theForm.lam5aantal.value*prijs_lam5_val;
lam10_val=theForm.lam10aantal.value*prijs_lam10_val;
lam15_val=theForm.lam15aantal.value*prijs_lam15_val;

lam2_val=lam2_val.toFixed(2);
lam5_val=lam5_val.toFixed(2);
lam10_val=lam10_val.toFixed(2);
lam15_val=lam15_val.toFixed(2);

theForm.lam2totaal.value=lam2_val;
theForm.lam5totaal.value=lam5_val;
theForm.lam10totaal.value=lam10_val;
theForm.lam15totaal.value=lam15_val;

// PupBrok
var prijs_pup2_val;
var prijs_pup5_val;
var prijs_pup10_val;
var pup2_val;
var pup5_val;
var pup10_val;

prijs_pup2_val=9;
prijs_pup5_val=18;
prijs_pup10_val=32.75;

pup2_val = theForm.pup2aantal.value * prijs_pup2_val;
pup5_val = theForm.pup5aantal.value * prijs_pup5_val;
pup10_val = theForm.pup10aantal.value * prijs_pup10_val;

pup2_val = pup2_val.toFixed(2);
pup5_val = pup5_val.toFixed(2);
pup10_val = pup10_val.toFixed(2);

theForm.pup2totaal.value = pup2_val;
theForm.pup5totaal.value = pup5_val;
theForm.pup10totaal.value = pup10_val;

[B]ETCETERA...[/B]

// TOTAAL
totaal_val = eval(pens_val)
           + eval(vlees_val)
	   + eval(lam2_val)
	   + eval(lam5_val)
	   + eval(lam10_val)
	   + eval(lam15_val)
	   + eval(pup2_val)
	   + eval(pup5_val)
	   + eval(pup10_val)
	   + eval(pupmix2_val)
	   + eval(pupmix5_val)
	   + eval(pupmix10_val)
	   + eval(junior2_val)
	   + eval(junior5_val)
	   + eval(junior10_val)
	   + eval(mix2_val)
	   + eval(mix5_val)
	   + eval(mix10_val)
	   + eval(brok2_val)
	   + eval(brok5_val)
	   + eval(brok10_val)
	   + eval(brok15_val)
	   + eval(excel2_val)
	   + eval(excel5_val)
	   + eval(excel15_val)
	   + eval(har2_val)
	   + eval(har5_val)
	   + eval(har15_val)
	   + eval(senior2_val)
	   + eval(senior5_val)
	   + eval(senior15_val)
	   + eval(smix2_val)
	   + eval(smix5_val)
	   + eval(smix10_val)
	   + eval(vega2_val)
	   + eval(vega5_val)
	   + eval(vega10_val)
	   + eval(vmix2_val)
	   + eval(vmix5_val)
	   + eval(vmix10_val)
	   + eval(kal2_val)
	   + eval(kal5_val)
	   + eval(kal15_val)
	   + eval(bas2_val)
	   + eval(bas5_val)
	   + eval(bas10_val)
	   + eval(rijst2_val)
	   + eval(rijst5_val)
	   + eval(rijst10_val)
	   + eval(cas2_val)
	   + eval(cas5_val)
	   + eval(cas15_val)
	   + eval(lr1_val)
	   + eval(vet600_val)
	   + eval(vet2_val)
	   + eval(teen800_val)
	   + eval(mel3_val)
	   + eval(dog2_val)
	   + eval(dog5_val)
	   + eval(dog15_val)
	   + eval(carni1_val);

theForm.allestotaal.value = totaal_val.toFixed(2);
}

-->
 </script>





<center>

<br>

<table border=0 cellspacing=1 width=95%>
<tr>
	<td>

	<font color=#333333><b> Online Bestellen</b></font> <br><br>

	<b>LET OP</b> In verband met werkzaamheden aan deze website, kan het voorkomen dat u na het klikken op de bestelknop een leeg formulier te zien krijgt en geen bevestiging van uw bestellen. U kunt dan het beste via e-mail of telefonisch bestellen. <br><br>
	<hr>
	
	Op onderstaand formulier kunt u uw bestelling invullen. <br><br>

	Wanneer u op de bestelknop klikt, ontvangt u automatisch een kopie van uw bestelling. Verzending van uw bestelling volgt als wij de storting van het totaalbedrag
	op onze bankrekeningnummer 47.81.12.556 ontvangen hebben. <br><br>
	
        Al onze producten worden <b>GRATIS BIJ U THUISBEZORGD</b> in <b>heel Zeeland</b> (met uitzondering van Zeeuws-Vlaanderen). Onze producten worden <u>niet per post</u> verzonden.

	<form method=post action="bestellijst.php" name="theForm">

	<table width=90% border=0 cellpadding=0 cellspacing=0>
       	<tr height=30> 
        		<td width=250> 	Naam 	</td>
		<td>	<input type="text" name="naam" size=50 value="" class=iveld_n>  	</td>
	</tr>
       	<tr height=30> 
        		<td> 	Bedrijfsnaam (indien van toepassing) 	</td>
		<td>	<input type="text" name="bedrijf" size=50 value="" class=iveld_n>   		</td>
	</tr>
       	<tr height=30> 
        		<td>	Adres (straat + nummer) 		</td>
		<td>	<input type="text" name="adres" size=50 value="" class=iveld_n>  		</td>
	</tr>
       	<tr height=30> 
        		<td>	Postcode 		</td>
		<td>	<input type="text" name="postcode" size=50 value="" class=iveld_n>  	</td>
	</tr>
       	<tr height=30> 
        		<td>	Woonplaats 		</td>
		<td>	<input type="text" name="plaats" size=50 value="" class=iveld_n>  	</td>
	</tr>
	<tr height=30>
        		<td> 	Telefoonnummer 		</td>
		<td>	<input type="text" name="telnr" size=50 value="" class=iveld_n> 		</td>
	</tr>
	<tr height=30> 
        		<td>	E-mail 			</td>
		<td>	<input type="text" name="mailadres" size=50 value="" class=iveld_n> 	</td>
	</tr>
	</table>

	<br><br>

	<table border=0 cellpadding=0 cellspacing=0>
	<tr height=30>
        	<td width=250>	<b>AHV Vers Vlees</b>		</td>
		<td width=250> &nbsp;
		</td>
		<td width=50> &nbsp;
		</td>
	</tr>	<tr height=30>
        	<td width=250>	Vlees Pens Compleet		</td>
		<td width=250>	<input type="text" style="text-align:right" name="pensaantal" size=2 value="0" class=iveld_n onChange="javascript:calcTotal()">
				<span id="lbl_pens"> zakjes van 500 gram x EUR 1,40 = </span>
		</td>
		<td width=50>	<input type="text" style="text-align:right" name="penstotaal" size=5 value="0.00" class=iveld_n readonly="1">
		</td>
	</tr>
	<tr height=30> 
        	<td>		Vlees Compleet		</td>
		<td>		<input type="text" style="text-align:right" name="vleesaantal" size=2 value="0" class=iveld_n onChange="javascript:calcTotal()">

				<span id="lbl_vlees"> zakjes van 500 gram x EUR 1,40 = </span>
		</td>
		<td>		<input type="text" style="text-align:right" name="vleestotaal" size=5 value="0.00" class=iveld_n readonly="1">  	</td>
	</tr>
<tr height=5><td><hr></td><td><hr></td><td><hr></td></tr>
	<tr height=30>
        	<td width=250> &nbsp; </td>
		<td width=250> &nbsp; </td>
		<td width=50>  &nbsp; </td>
	</tr>
	<tr height=30>
        	<td width=250>	<b>Jarco</b>		</td>
		<td width=250> &nbsp;
		</td>
		<td width=50> &nbsp;
		</td>
	</tr>
	<tr height=30>
        	<td width=250>	Lam/Rijst Brok		</td>
		<td width=250>	<input type="text" style="text-align:right" name="lam2aantal" size=2 value="0" class=iveld_n onChange="javascript:calcTotal()">
				<span id="lbl_lam2"> x 2,5 kg (EUR 11,25) </span>
		</td>
		<td width=50>	<input type="text" style="text-align:right" name="lam2totaal" size=5 value="0.00" class=iveld_n readonly="1">
		</td>
	</tr>
	<tr height=30>
        	<td width=250>	&nbsp;		</td>
		<td width=250>	<input type="text" style="text-align:right" name="lam5aantal" size=2 value="0" class=iveld_n onChange="javascript:calcTotal()">
				<span id="lbl_lam5"> x 5 kg (EUR 22,50) </span>
		</td>
		<td width=50>	<input type="text" style="text-align:right" name="lam5totaal" size=5 value="0.00" class=iveld_n readonly="1">
		</td>
	</tr>
	<tr height=30>
        	<td>		&nbsp;		</td>
		<td>		<input type="text" style="text-align:right" name="lam10aantal" size=2 value="0" class=iveld_n onChange="javascript:calcTotal()">

				<span id="lbl_lam10"> x 10 kg (EUR 36,50) </span>
		</td>
		<td>		<input type="text" style="text-align:right" name="lam10totaal" size=5 value="0.00" class=iveld_n readonly="1">  	</td>
	</tr>
	<tr height=30>
        	<td>		&nbsp;		</td>
		<td>		<input type="text" style="text-align:right" name="lam15aantal" size=2 value="0" class=iveld_n onChange="javascript:calcTotal()">

				<span id="lbl_lam15"> x 15 kg (EUR 55,00) </span>
		</td>
		<td>		<input type="text" style="text-align:right" name="lam15totaal" size=5 value="0.00" class=iveld_n readonly="1">  	</td>
	</tr>

[B]ETCETERA...[/B]

	<tr height=10>
        		<td>		&nbsp;		</td>
		<td align=right>	&nbsp; </td>
		<td>		-------------  +	</td>
	</tr>
	<tr height=30> 
        		<td>		&nbsp;		</td>
		<td align=right>		 Totaal (EUR)</td>
		<td>		<input type="text" style="text-align:right" name="allestotaal" size=5 value="0.00" class=iveld_n>
 	</td>
	</tr>
	</table>


	<br><br>

<!-- Start Opmerking, BeveiligingsCode en VerzendKnop -->

	<table width=90% border=0 cellpadding=0 cellspacing=0>
	<tr>
		<td  width=250 valign=top> Aanvulling, vraag of dergelijke </td>
		<td> <textarea name="opm" rows=5 cols=38 maxlength=255 class=iveld_e></textarea>	</td>
	</tr>
       	<tr height=30>
        		<td>	Beveiligingscode <img src="CaptchaSecurityImages.php?width=100&height=40&characters=5" />	 		</td>
		<td>	<input id="security_code" name="security_code" class=iveld_n size=20 type="text" />  	</td>
	</tr>
	</table>

	<br>


	<table width=90% border=0 cellpadding=0 cellspacing=0>
	<tr height=40>
		<td align=middle width=250>	
			&nbsp;
		</td>		
		<td align=middle width=275>	
			 <input type="submit" name="submit" align=center value=" Klik HIER om uw bestelling NU te plaatsen " class='knop'>
		</td>		
		<td align=middle>	
			&nbsp;
		</td>		
	</tr>
	</table>
</form>

<script language="JavaScript" type="text/javascript">
//You should create the validator only after the definition of the HTML form
  var frmvalidator  = new Validator("theForm");

  frmvalidator.addValidation("naam","req");
  frmvalidator.addValidation("naam","maxlen=50");

  frmvalidator.addValidation("adres","req");
  frmvalidator.addValidation("adres","maxlen=50");

  frmvalidator.addValidation("postcode","req");
  frmvalidator.addValidation("postcode","minlen=4");

  frmvalidator.addValidation("plaats","req");
  frmvalidator.addValidation("plaats","maxlen=50");

  frmvalidator.addValidation("telnr","maxlen=50");
  frmvalidator.addValidation("telnr","numeric");

  frmvalidator.addValidation("mailadres","maxlen=50");
  frmvalidator.addValidation("mailadres","req");
  frmvalidator.addValidation("mailadres","email");



</script>





<!-- <input type="submit" onClick="javascript:calcTotal()" value="Bereken totaalprijs">	-->


	<br>

</td></tr></table>

<br><br>

</center>

</BODY>
</HTML>

Ok, the first thing you need to do is turn off register_globals, recode your php to work off the post and not the $variable.
ie: $naam will be $_POST.

After these changes are made test out your script. If the problem persist, it still seems to be a security code issue.

Also, unless I am missing something, there is no need to wordwrap an HTML email, remove that line(103) from the php file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.