My contact form used to work but I did something to it, what did I do?

I used to have a working code but I have no idea what I did wrong in the editing process, since now it doesn’t work, just gives me a blank page. The text is in finnish but you get the idea from the html/php.

Here’s the form HTML:

[code]












	<td width="314"><input type="text" name="puheenjohtaja" size="50"></td>
</tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">Nimi</font></td>
	</tr>
<tr>

	<td width="204">&nbsp;</td>
	<td width="314"><input type="text" name="puheenjohtaja_lahiosoite" size="50"></td>
	</tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">Lähiosoite</font></td>
	</tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="puheenjohtaja_postitoimipaikka" size="50" /></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">Postitoimipaikka</font></td>
  </tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><input type="text" name="puheenjohtaja_puh_toimi" size="20" /></td>
	</tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">Puh. toimeen</font></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="puheenjohtaja_puh_koti" size="20" /></td>
  </tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">Puh. kotiin</font></td>
	</tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="puheenjohtaja_email" size="50" /></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">email</font></td>
  </tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><input type="text" name="puheenjohtaja_gsm" size="20"></td>
	</tr>
<tr>

	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">gsm</font></td>
	</tr>
<tr>
	<td width="204"><b><font face="Arial" size="2">Sihteeri:</font></b></td>
	<td width="314"><input type="text" name="sihteeri" size="50"></td>

</tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">Nimi</font></td>
	</tr>
<tr>
	<td width="204">&nbsp;</td>

			<td width="314"><input type="text" name="sihteeri_lahiosoite" size="50"></td>
		  </tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">Lähiosoite</font></td>
	</tr>

<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="sihteeri_postitoimipaikka" size="50" /></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">Postitoimipaikka</font></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="sihteeri_puh_toimi" size="20" /></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">Puh. toimeen</font></td>
  </tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><input type="text" name="sihteeri_puh_koti" size="20"></td>
	</tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">Puh. kotiin</font></td>
	</tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="sihteeri_email" size="50" /></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">email</font></td>
  </tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><input type="text" name="sihteeri_gsm" size="20"></td>
	</tr>
<tr>

	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">gsm</font></td>
	</tr>
<tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>
<tr>
	<td width="204"><b><font size="2" face="Arial">Opintosihteeri:</font></b></td>
	<td width="314"><input type="text" name="opintosihteeri_sihteeri" size="50"></td>
	</tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">Nimi</font></td>
	</tr>
<tr>

	<td width="204">&nbsp;</td>
	<td width="314"><input type="text" name="opintosihteeri_lahiosoite" size="50"></td>
	</tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">Lähiosoite</font></td>
	</tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="opintosihteeri_postitoimipaikka" size="50" /></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">Postitoimipaikka</font></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="opintosihteeri_puh_toimi" size="20" /></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">Puh. toimeen</font></td>
  </tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><input type="text" name="opintosihteeri_puh_koti" size="20"></td>
	</tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">Puh. kotiin</font></td>
	</tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><input type="text" name="opintosihteeri_gsm" size="20"></td>
	</tr>
<tr>

	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">gsm</font></td>
	</tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="opintosihteeri_email" size="50" /></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">email</font></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>
<tr>
	<td width="204"><b><font size="2" face="Arial">Taloudenhoitaja:</font></b></td>
	<td width="314"><input type="text" name="taloudenhoitaja" size="50"></td>
	</tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">Nimi</font></td>
	</tr>
<tr>

	<td width="204">&nbsp;</td>
			<td width="314"><input type="text" name="taloudenhoitaja_lahiosoite" size="50"></td>
	</tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">Lähiosoite</font></td>
	</tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="taloudenhoitaja_postitoimipaikka" size="50" /></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">Postitoimipaikka</font></td>
  </tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><input type="text" name="taloudenhoitaja_puh_koti" size="20"></td>
	</tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">Puh. kotiin</font></td>
	</tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="taloudenhoitaja_puh_toimi" size="20" /></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">Puh. toimeen</font></td>
  </tr>
<tr>
	<td width="204">&nbsp;</td>
	<td width="314"><input type="text" name="taloudenhoitaja_gsm" size="20"></td>
	</tr>
<tr>

	<td width="204">&nbsp;</td>
	<td width="314"><font face="Arial" size="2">gsm</font></td>
	</tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="taloudenohoitaja_email" size="50" /></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">email</font></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><input type="text" name="kenelleposti" size="50" /></td>
  </tr>
<tr>
  <td>&nbsp;</td>
  <td><font face="Arial" size="2">Järjestön posti lähetetään</font></td>
  </tr>
Järjestötiedot:


20

Järjestön nimi:
Jäsenmäärä:
Puheenjohtaja:

[/code]

Aaand the PHP:

[php]<?php
if(isset($_POST[‘email’])) {

// EDIT THE 2 LINES BELOW AS REQUIRED
$email_to = "[email protected]";
$email_subject = "Jasenjarjestoilmoitus";
 
 
function died($error) {
    // your error code can go here
    echo "We are very sorry, but there were error(s) found with the form you submitted. ";
    echo "These errors appear below.<br /><br />";
    echo $error."<br /><br />";
    echo "Please go back and fix these errors.<br /><br />";
    die();
}
 
// validation expected data exists
if(!isset($_POST['vuosi']) ||
    !isset($_POST['jarjeston nimi']) ||
    !isset($_POST['jasenmaara']) ||
    !isset($_POST['puheenjohtaja']) ||
    !isset($_POST['puheenjohtaja_lahiosoite'])) {
    died('We are sorry, but there appears to be a problem with the form you submitted.');      
}
 
$vuosi = $_POST['vuosi']; // required
$jarjeston_nimi = $_POST['jarjeston_nimi']; // required
$jasenmaara = $_POST['jasenmaara']; // not required
$puheenjohtaja = $_POST['puheenjohtaja']; // not required
$puheenjohtaja_lahiosoite = $_POST['puheenjohtaja_lahiosoite']; // not required
$puheenjohtaja_postitoimipaikka = $_POST['puheenjohtaja_postitoimipaikka']; // not required
$puheenjohtaja_puh_toimi = $_POST['puheenjohtaja_puh_toimi']; // not required
$puheenjohtaja_puh_koti = $_POST['puheenjohtaja_puh_koti']; // not required
$puheenjohtaja_email = $_POST['puheenjohtaja_email']; // not required
$puheenjohtaja_gsm = $_POST['puheenjohtaja_gsm']; // not required
$sihteeri = $_POST['sihteeri']; // not required
$sihteeri_lahiosoite = $_POST['sihteeri_lahiosoite']; // not required
$sihteeri_postitoimipaikka = $_POST['sihteeri_postitoimipaikka']; // not required
$sihteeri_puh_toimi = $_POST['sihteeri_puh_toimi']; // not required
$sihteeri_puh_koti = $_POST['sihteeri_puh_koti']; // not required
$sihteeri_email = $_POST['sihteeri_email']; // not required
$sihteeri_gsm = $_POST['sihteeri_gsm']; // not required
$opintosihteeri_sihteeri = $_POST['opintosihteeri_sihteeri']; // not required
$opintosihteeri_lahiosoite = $_POST['opintosihteeri_lahiosoite']; // not required
$opintosihteeri_postitoimipaikka = $_POST['opintosihteeri_postitoimipaikka']; // not required
$opintosihteeri_puh_toimi = $_POST['opintosihteeri_puh_toimi']; // not required
$opintosihteeri_puh_koti = $_POST['opintosihteeri_puh_koti']; // not required
$opintosihteeri_gsm = $_POST['opintosihteeri_gsm']; // not required
$opintosihteeri_email = $_POST['opintosihteeri_email']; // not required
$taloudenhoitaja = $_POST['taloudenhoitaja']; // not required
$taloudenhoitaja_lahiosoite = $_POST['taloudenhoitaja_lahiosoite']; // not required
$taloudenhoitaja_postitoimipaikka = $_POST['taloudenhoitaja_postitoimipaikka']; // not required
$taloudenhoitaja_puh_koti = $_POST['taloudenhoitaja_puh_koti']; // not required
$taloudenhoitaja_puh_toimi = $_POST['taloudenhoitaja_puh_toimi']; // not required
$taloudenhoitaja_gsm = $_POST['taloudenhoitaja_gsm']; // not required
$taloudenohoitaja_email = $_POST['taloudenohoitaja_email']; // not required
$kenelleposti = $_POST['kenelleposti']; // not required
 
$error_message = "There was a problem. Please try again.";
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';

if(!preg_match($email_exp,$email_from)) {
$error_message .= ‘The Email Address you entered does not appear to be valid.
’;
}
$string_exp = “/^[A-Za-z .’-]+$/”;
if(!preg_match($string_exp,$first_name)) {
$error_message .= ‘The First Name you entered does not appear to be valid.
’;
}
if(!preg_match($string_exp,$last_name)) {
$error_message .= ‘The Last Name you entered does not appear to be valid.
’;
}
if(strlen($comments) < 2) {
$error_message .= ‘The Comments you entered do not appear to be valid.
’;
}
if(strlen($error_message) > 0) {
died($error_message);
}
$email_message = “Sivujen kautta tehty ilmoitus.\n\n”;

function clean_string($string) {
  $bad = array("content-type","bcc:","to:","cc:","href");
  return str_replace($bad,"",$string);
}
 
$email_message .= "Jarjestotiedot: ".clean_string($vuosi)."\n";
$email_message .= "Jarjeston nimi: ".clean_string($jarjeston_nimi)."\n";
$email_message .= "Jasenmaara: ".clean_string($jasenmaara)."\n";
$email_message .= "Puheenjohtaja: ".clean_string($puheenjohtaja)."\n";
$email_message .= "Osoite: ".clean_string($puheenjohtaja_lahiosoite)."\n";
$email_message .= "Postitoimipaikka: ".clean_string($puheenjohtaja_postitoimipaikka)."\n";
$email_message .= "Puhelin toimeen: ".clean_string($puheenjohtaja_puh_toimi)."\n";
$email_message .= "Puhelin kotiin: ".clean_string($puheenjohtaja_puh_koti)."\n";
$email_message .= "Email: ".clean_string($puheenjohtaja_email)."\n";
$email_message .= "GSM: ".clean_string($puheenjohtaja_gsm)."\n";
$email_message .= "Sihteeri: ".clean_string($sihteeri)."\n";
$email_message .= "Osoite: ".clean_string($sihteeri_lahiosoite)."\n";
$email_message .= "Postitoimipaikka: ".clean_string($sihteeri_postitoimipaikka)."\n";
$email_message .= "Puhelin toimeen: ".clean_string($sihteeri_puh_toimi)."\n";
$email_message .= "Puhelin kotiin: ".clean_string($sihteeri_puh_koti)."\n";
$email_message .= "Email: ".clean_string($sihteeri_email)."\n";
$email_message .= "GSM: ".clean_string($sihteeri_gsm)."\n";
$email_message .= "Opintosihteeri: ".clean_string($opintosihteeri_sihteeri)."\n";
$email_message .= "Osoite: ".clean_string($opintosihteeri_lahiosoite)."\n";
$email_message .= "Postitoimipaikka: ".clean_string($opintosihteeri_postitoimipaikka)."\n";
$email_message .= "Puhelin toimeen: ".clean_string($opintosihteeri_puh_toimi)."\n";
$email_message .= "Puhelin kotiin: ".clean_string($lopintosihteeri_puh_koti)."\n";
$email_message .= "GSM: ".clean_string($opintosihteeri_gsm)."\n";
$email_message .= "Email: ".clean_string($opintosihteeri_email)."\n";
$email_message .= "Taloudenhoitaja: ".clean_string($taloudenhoitaja)."\n";
$email_message .= "Osoite: ".clean_string($taloudenhoitaja_lahiosoite)."\n";
$email_message .= "Postitoimipaikka: ".clean_string($taloudenhoitaja_postitoimipaikka)."\n";
$email_message .= "Puhelin kotiin: ".clean_string($taloudenhoitaja_puh_koti)."\n";
$email_message .= "Puhelin toimeen: ".clean_string($taloudenhoitaja_puh_toimi)."\n";
$email_message .= "GSM: ".clean_string($taloudenhoitaja_gsm)."\n";
$email_message .= "Email: ".clean_string($taloudenohoitaja_email)."\n";
$email_message .= "Posti lahetetaan: ".clean_string($kenelleposti)."\n";

// create email headers
$headers = 'From: '.$puheenjohtaja_email."\r\n".
'Reply-To: '.$puheenjohtaja_email."\r\n" .
‘X-Mailer: PHP/’ . phpversion();
@mail($email_to, $email_subject, $email_message, $headers);
?>

Kiitos yhteydenotostanne.

<?php } ?>[/php]

I just can’t point out what I did wrong, help?

my first guess would be those variables. those have to be the longest i’ve ever seen :slight_smile: Verify that the data is getting through with print_r($_POST). you’ll one very long array, but you can see what (if anything) is getting passed to the next page.

Well, Richei is correct, most likely you are missing a variable that was pulled by a $_POST()…

BUT, my first guess is the very first line…
–> if(isset($_POST[‘email’])) { <–

I could not find the FIELD ‘email’ on your HTML page. That is quite possible your problem. I am guessing you may have changed your FORM name from “email” to “contactform” … Just a guess!

Good luck…

Sponsor our Newsletter | Privacy Policy | Terms of Service