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]
Järjestötiedot: |
|
Järjestön nimi: | |
Jäsenmäärä: | |
Puheenjohtaja: |
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?