Returnpagina na formulier

Status
Niet open voor verdere reacties.

Bizziebee

Gebruiker
Lid geworden
23 apr 2008
Berichten
10
Hai,
Ik weet iets van PHP maar ben helaas ook geen expert zoals wel meer hier...
Op mijn website staat een contactformulier dat het prima doet, de gegevens worden naar mijn e-mailadres verstuurd en na het invullen staan de ingevulde gegevens prima in het returnscherm getoond.

Ik ben nu bezig een nieuw formulier te maken: copy paste het originele formulier. Ik heb al gezien dat in mijn pagina wordt verwezen naar een ander php-document (formmail) en die heb ik ook gekopieerd en nieuwe naam gegeven - de nieuwe naam ook aangepast op de formulierpagina.
Anyway, so far so good.
Ik loop tegen twee problemen aan:
- als ik het nieuwe formulier invul op de website worden de ingevulde gegevens netjes getoond in de goede 'returnpagina', alleen worden de frames (zo noem ik het maar even) door elkaar gegooid > normaal staat mijn menu netjes links, maar is nu verschoven naar rechts
- een van de velden wordt in de naar mij verstuurde e-mail dubbel getoond, bij eentje is het antwoord niet ingevuld, en eronder staat : , bij eentje is het antwoordwel ingevuld. Hier zit dus iets niet goed.

Kan iemand mij een hint geven waar de fout kan zitten? Ik hoop dat mijn uitleg duidelijk is. ;)
Ik kan de code hier uiteraard nog neerzetten als dat nodig is!
 
Plaats de broncode maar even dat zal je verhaal verduidelijken ;)

Waarschijnlijk heb je 2 bestanden als ik je verhaal goed begrijp.

Gelieve de code even tussen
PHP:
...
plaatsen ;)
 
Hey leuk, al een reactie!

Het formulier:
PHP:
<!-- Begin formulier -->
            </p>
            </td>
		<td width="20" valign="top"></td>
		<td valign="top" width="360">
	    <?php  
    	if ( $recipient != '') {
    	 include ('inc/formmail_nieuwsbrief.php');
    	}
    	if ( $recipient == '') {
    	}
    	if ($foutmelding != 'ja' and $verzending != 'ok') {
    	?>
    	<FORM METHOD="POST" ACTION="nieuwsbrief.php">
		<input type="hidden" name="recipient" value="********.nl">
		<!-- uncommented <input TYPE="hidden" NAME="redirect" VALUE=""> -->
		<input type="hidden" name="subject" value="Contactformulier nieuwsbrief via ********"> 
		<input type="hidden" name="required" value="realname,Telefoon,email">
		<input type="hidden" name="sort" value="order:Praktijknaam,Apotheekhoudend,realname,De_heer_mevr,Functie,email,email2,Telefoon,Adres,Postcode,Woonplaats,nieuwsbrief,suggestie"> 
		<input type="hidden" name="alias" value="praktijknaam=Praktijknaam,Apotheekhoudend=Apotheekhoudend,realname=Naam,De_heer_mevr=De heer of mevrouw,functie=Functie,email=E-mail adres,Adres=Praktijkadres,Postcode=Postcode,Woonplaats=Woonplaats,Telefoon=Telefoonnummer,email2=E-mail adres 2,nieuwsbrief=Nieuwsbrief,Suggestie=Mijn idee of suggestie"> 
		<input type="hidden" name="env_report" value="REMOTE_ADDR,HTTP_USER_AGENT">
		<input type="hidden" name="priority" value="3">
		<input type="hidden" name="title" value="U heeft het formulier niet geheel ingevuld:">
		<!-- uncommented<input type="hidden" name="css" value="http://www.*****.nl/css/*****_ie7_vervolg.css"> -->
		<input type="hidden" name="email_regex" value="[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,6}$">
		<input type="hidden" name="print_blank_fields" value="true">

		<table cellspacing="0" cellpadding="2" width="100%">
		<tr>
		<td>Praktijknaam:</td>
		<td><input type="text" class="fillin" name="Praktijknaam" size=35 maxlength=100 value='<?php echo $Praktijknaam; ?>'></td>
		</tr>
		<tr>
		<td>Apotheekhoudend:</td>
		<td><input type="radio" checked name="Apotheekhoudend" value="niet apotheekhoudend">Nee&nbsp;<input type="radio"  name="Apotheekhoudend" value="apotheekhoudend">Ja</td>
		</tr>
		<tr>
		<td>Naam:<font color="#FF2883">*</font></td>
		<td><input type="text" class="fillin" name="realname" size=35 maxlength=100 value='<?php echo $realname; ?>'></td>
		</tr>
		<td width="30%"></td>
		<td><input type="radio" checked name="De_heer_mevr" value="De heer">de heer&nbsp;<input type="radio"  name="De_heer_mevr" value="Mevrouw">mevrouw</td>
		</tr>
		<tr><td>Functie:</td>
		<td><input type="text" class="fillin" name="Functie" size=35 maxlength=100 value='<?php echo $Functie; ?>'></td>
		</tr>
		<tr><td>E-mail adres:<font color="#FF2883">*</font></td>
		<td><input type="text" class="fillin" name="email" size=35 value='<?php echo $email; ?>' maxlength=100></td>
		</tr>
		<tr><td>E-mail adres2:</td>
		<td><input type="text" class="fillin" name="email2" size=35 value='<?php echo $email2; ?>' maxlength=100></td>
		</tr>
		<tr><td>Telefoon:<font color="#FF2883">*</font></td>
		<td><input type="text" class="fillin" name="Telefoon" size=35 maxlength=11 value='<?php echo $Telefoon; ?>'></td>
		</tr>
		<tr><td>Praktijkadres:</td>
		<td><input type="text" class="fillin" name="Adres" size=35 maxlength=100 value='<?php echo $Adres; ?>'></td>
		</tr>
		<tr><td>Postcode:</td>
		<td><input type="text" class="fillin" name="Postcode" size=35 maxlength=7 value='<?php echo $Postcode; ?>'></td>
		</tr>
		<tr><td>Woonplaats:</td>
		<td><input type="text" class="fillin" name="Woonplaats" size=35 maxlength=100 value='<?php echo $Woonplaats; ?>'></td>
		</tr>
		<td>Ik wil de nieuwsbrief ontvangen:</td>
		<td><input type="radio" checked name="Nieuwsbrief" value="Nieuwsbrief">Ja&nbsp;<input type="radio"  name="Nieuwsbrief" value="geen nieuwsbrief">Nee</td>
		</tr>
		<tr valign="top">
		<td>Mijn idee of suggestie:</td>
		<td><textarea class="fillin" name="Suggestie" cols="37" rows="8"><?php echo $Vsuggestie; ?></textarea></td>
		</tr>
		<tr><td><font color="#FF2883">*</font> <small>Verplichte velden</small></td><td><br><input type="submit" value="   Versturen   "></FORM></table></td></tr>
		</TABLE>
		<?php } ?>
		
		
		
		
	
	
	
	<!-- //einde formulier -->

Probleem van dubbele veld in e-mail zit 'm in het veld "Nieuwsbrief" ja of nee.
Wil je het bijbehorende formmail_nieuwsbrief ook nog zien?
 
Ik denk dat ik aan nieuwsbrief.php meer zal hebben aangezien die het formulier verwerkt ;)
 
Formmail_nieuwsbrief
(ik heb alles tussen /********** en / weggehaald omdat dit volgens mij alleen instructies zijn en geen script)

PHP:
<?PHP
define('VERSION','********');
define('MANUAL','http://www.boaddrink.com/projects/phpformmail/readme.php');
define('CHECK_REFERER', true);

// To change the address the e-mail comes from use define('FROM', 'Example Name <email@example.com>');
define('FROM', 'www.*****.nl <info@*****.nl>');

$referers = array('www.*****.nl', ******.nl');

// $recipient_array format is $recipient_array = array('sometext'=>'email@example.com','asdf'=>'email2@example.com');
$recipient_array = array();

$valid_env = array('REMOTE_HOST', 'REMOTE_ADDR', 'REMOTE_USER', 'HTTP_USER_AGENT');


$errors = $fieldname_lookup = array();
$invis_array = array('recipient','subject','required','redirect',
		     'print_blank_fields','env_report','sort',
		     'missing_fields_redirect','title','bgcolor',
		     'text_color','link_color','alink_color',
		     'vlink_color','background','subject','title',
		     'link','css','return_link_title',
		     'return_link_url','recipient_cc','recipient_bcc',
				 'priority','redirect_values','hidden','alias',
         'mail_newline', 'gmt_offset', 'alias_method',
         'subject_prefix');


function fake_in_array($needle, $haystack)
{
	$found = false;
	while (list($key,$val) = each ($haystack)) {
		if ($needle == $val)
			$found = true;
	}
	return $found;
}


function check_referer($referers)
{
	global $errors;
	if (count($referers)) {
		if (getenv('HTTP_REFERER')) {
			$temp = explode('/', getenv('HTTP_REFERER'));
			$found = false;
			while (list(,$stored_referer) = each($referers)) {
				if (eregi('^' . $stored_referer . '$', $temp[2]))
					$found = true;
			}
			if (!$found) {
				$errors[] = '1|You are coming from an unauthorized domain.  Please read the manual section titled &quot;<a href="' . MANUAL . '#setting_up" target="_blank">Setting Up the PHPFormMail Script</a>&quot;.';
				error_log('[PHPFormMail] Illegal Referer. (' . getenv('HTTP_REFERER') . ')', 0);
			}
			return $found;
		} else {
			$errors[] = '0|Sorry, but I cannot figure out who sent you here.  Your browser is not sending an HTTP_REFERER.  This could be caused by a firewall or browser that removes the HTTP_REFERER from each HTTP request you submit.';
			error_log('[PHPFormMail] HTTP_REFERER not defined. Browser: ' . getenv('HTTP_USER_AGENT') . '; Client IP: ' . getenv('REMOTE_ADDR') . '; Request Method: ' . getenv('REQUEST_METHOD') . ';', 0);
			return false;
		}
	} else {
		$errors[] = '1|There are no referers defined.  All submissions will be denied.  Please read the manual section titled &quot;<a href="' . MANUAL . '#setting_up" target="_blank">Setting Up the PHPFormMail Script</a>&quot;.';
		error_log('[PHPFormMail] You have no referers defined.  All submissions will be denied.', 0);
		return false;
	}
}


function check_recipients($recipient_list)
{
	global $errors, $referers;
	$recipients_ok = true;
	$recipient_list = explode(',', $recipient_list);
	while (list(,$recipient) = each($recipient_list)) {
		$recipient_domain = false;
		$recipient = trim($recipient);
		reset($referers);
		while ((list(,$stored_domain) = each($referers)) && ($recipient_domain == false)) {
			if (eregi('^[_\.a-z0-9-]*@' . $stored_domain . '$', $recipient))
				$recipient_domain = true;
		}
		if ($recipient_domain == false) {
			$recipients_ok = false;
			error_log('[PHPFormMail] Illegal Recipient: ' . $recipient . ' from ' . getenv('HTTP_REFERER'), 0);
		}
	}
	if (!$recipients_ok)
		$errors[] = '1|You are trying to send mail to a domain that is not in the allowed recipients list.   Please read the manual section titled &quot;<a href="' . MANUAL . '#setting_up" target="_blank">Setting Up the PHPFormMail Script</a>&quot;.';
	return join(',', $recipient_list);
}


function map_recipients($recipient_list)
{
	global $errors, $recipient_array;
	$recipients_ok = true;
	$recipient_list = explode(',',$recipient_list);
	while (list(,$val) = each($recipient_list)){
		$val = trim($val);
		if(isset($recipient_array[$val]))
			$output[] = $recipient_array[$val];
		else
			$recipients_ok = false;
	}
	if (!$recipients_ok)
		$errors[] = '1|You are trying to send mail to an address that is not listed in the recipient array.';
	if (isset($output))
		return join(',', $output);
	else
		return null;
}



function decode_vars()
{
	if (isset($_REQUEST))
		$request = '_' . getenv('REQUEST_METHOD');
	else
		$request = 'HTTP_' . getenv('REQUEST_METHOD') . '_VARS';
	global $$request;
	if (count($$request) > 0) {
		while (list($key, $val) = each($$request)) {
			if (is_array($val))
				$val = implode(', ',$val);
			$output[$key] = stripslashes($val);
		}
		return $output;
	} else
		return array();
}



function error()
{
	global $form, $natural_form, $errors;
	if (isset($form['missing_fields_redirect'])) {
		if (isset($form['redirect_values']))
			header('Location: ' . $form['missing_fields_redirect'] . '?' . getenv('QUERY_STRING') . "\r\n");
		else
			header('Location: ' . $form['missing_fields_redirect'] . "\r\n");
	} else {
		if(!isset($form['title']))
			$form['title'] = 'PHPFormMail - Error';
		$output = "<b><font color='#FF2883'>Er is een fout opgetreden:</b></font><ul>";
		$crit_error = 0;
		while (list(,$val) = each ($errors)) {
			list($crit,$message) = explode('|',$val);
			$output .= '  <li>' . $message . "</li>\n";
			if ($crit == 1)
				$crit_error = 1;
		}
		$output .= "</ul>\n";
		if ($crit_error == 1)
			$output .=  "<div class=\"crit\">Er zijn fouten geconstateerd die moeten worden verholpen door de webmaster. Het formulier wordt niet verzonden tot het probleem is opgelost.</div> Ga alstublieft <a href=\"javascript: history.back();\">terug naar het formulier</a> om dit goed in te vullen.\n";
		else
		  $foutmelding = "ja";
			$output .=  "<font color='#FF2883'>Vul de ontbrekende gegevens alstublieft nog in.</font><br>\n";
		  output_html($output);
			return $foutmelding;
	}
}

function check_required()
{
	global $form, $errors, $invis_array, $fieldname_lookup;
	$problem = true;
	if ((!isset($form['recipient'])) && (!isset($form['recipient_bcc']))) {
		$problem = false;
		$errors[] = '1|There is no recipient to send this mail to.  Please read the manual section titled &quot;<a href="' . MANUAL . '#recipient" target="_blank">Form Configuration - Recipient</a>&quot;.';
		error_log('[PHPFormMail] There is no recipient defined from ' . getenv('HTTP_REFERER'), 0);
	}
	if (isset($form['required'])) {
		$required = split(',', $form['required']);
		while (list(,$val) = each($required)) {
			$val = trim($val);
			$regex_field_name = $val . '_regex';
			if ((!isset($form[$val])) || (isset($form[$val]) && (strlen($form[$val]) < 1))) {
				$problem = false;
				if (isset($fieldname_lookup[$val]))
					$field = $fieldname_lookup[$val];
				else
					$field = $val;
				$errors[] = '0|<b>' . $field . '</b> ontbreekt';
			} else if (isset($form[$regex_field_name])) {
				if (!eregi($form[$regex_field_name],$form[$val])) {
					$problem = false;
					$errors[] = '0|In <b>' . $fieldname_lookup[$val] . '</b> is een typefout gemaakt.';
				}
				$invis_array[] = $regex_field_name;
			}
		}
	}
	return $problem;
}



function sort_fields()
{
	global $form;
	switch ($form['sort']) {
		case 'alphabetic':
		case 'alpha':		ksort($form);
					break;
		case 'ralphabetic':
		case 'ralpha':		krsort($form);
					break;
		default:		if ($col = strpos($form['sort'],':')) {
						$form['sort'] = substr($form['sort'],($col + 1));
						$temp_sort_arr = explode(',', $form['sort']);
						for($x = 0; $x < count($temp_sort_arr); $x++) {
							$out[$temp_sort_arr[$x]] = $form[$temp_sort_arr[$x]];
							unset($form[$temp_sort_arr[$x]]);
						}
						$form = array_merge($out,$form);
					}
	}
	return true;
}




function alias_fields()
{
	global $form, $fieldname_lookup;
	while (list($key,) = each($form)) {
		$fieldname_lookup[$key] = $key;
	}
	reset($form);
	if (isset($form['alias'])) {
		$aliases = explode(',', $form['alias']);
		while (list(,$val) = each($aliases)) {
			$temp = explode('=', $val);
			$fieldname_lookup[trim($temp[0])] = trim($temp[1]);
		}
	}
	return true;
}



function send_mail()
{
	global $form, $invis_array, $valid_env, $fieldname_lookup, $errors;
	
	$email_replace_array = "\r|\n|to:|cc:|bcc:";
	
	if (!isset($form['subject']))
			$form['subject'] = 'WWW Form Submission';
	if (isset($form['subject_prefix']))
			$form['subject'] = $form['subject_prefix'] . $form['subject'];
	if (!isset($form['email']))
			$form['email'] = 'email@example.com';
	
	switch ($form['mail_newline']) {
		case 2:		$mail_newline = "\r";
				break;
		case 3:		$mail_newline = "\r\n";
				break;
		default:	$mail_newline = "\n";
	}
	
	if (isset($form['gmt_offset']) && ereg('^(\\-|\\+)?([0-9]{1}|(1{1}[0-2]{1}))$', $form['gmt_offset'])) {
		$mkseconds = mktime(gmdate('H') + $form['gmt_offset']);
		$mail_date = gmdate('F jS, Y', $mkseconds) . ' at ' . gmdate('h:iA', $mkseconds) . ' (GMT ' . $form['gmt_offset'] . ').';
	} else
		$mail_date = date('F jS, Y') . ' at ' . date('h:iA (T).');
	
	if (isset($form['realname']))
		$realname = eregi_replace($email_replace_array,'',$form['realname']);
	elseif (isset($form['firstname']) || isset($form['lastname']))
		$realname = eregi_replace($email_replace_array,'',trim($form['firstname'] . ' ' . $form['lastname']));

	$mailbody = 'Via de website is het contactformulier ingevuld door:' . $mail_newline;
	if (isset($realname))
		$mailbody.= $realname . ' (' . $form['email'] . ').  ' . $mail_newline . $mail_newline;
	else
		$mailbody.= $form['email'] . '. '  . $mail_newline . $mail_newline;

	reset($form);
	
	while (list($key,$val) = each($form)) {
		if ((!in_array($key,$invis_array)) && ((isset($form['print_blank_fields'])) || ($val))) {
				if(($form['alias_method'] == 'email') || ($form['alias_method'] == 'both'))
					$mailbody .= $fieldname_lookup[$key];
				else
					$mailbody .= $key;
			$mailbody .= ': ' . $mail_newline . $val . $mail_newline;
		}
	}
	
	if (isset($form['env_report'])) {
		$temp_env_report = explode(',', $form['env_report']);
		$mailbody .= $mail_newline . $mail_newline . '-------- Technische gegevens van de afzender: --------' . $mail_newline;
		while (list(,$val) = each($temp_env_report)) {
			if (in_array($val,$valid_env))
					$mailbody .= eregi_replace($email_replace_array,'',$val) . ': ' . eregi_replace($email_replace_array,'',getenv($val)) . $mail_newline;
		}
	}

	if (!isset($form['recipient']))
		$form['recipient'] = '';

	// Append lines to $mail_header that you wish to be
	// added to the headers of the e-mail. (SMTP Format
	// with newline char ending each line)

	$mail_header = 'Return-Path: ' . eregi_replace($email_replace_array,'',$return_path) . $mail_newline;
	if (FROM != null)
		$mail_header .= 'From: ' . FROM . $mail_newline;
	$mail_header .= 'Reply-to: ';
	if (isset($realname))
		$mail_header .= $realname . ' <' . eregi_replace($email_replace_array,'',$form['email']) . '>' . $mail_newline;
	else
		$mail_header .= eregi_replace($email_replace_array,'',$form['email']) . $mail_newline;
	if (isset($form['recipient_cc']))
		$mail_header .= 'Cc: ' . eregi_replace($email_replace_array,'',$form['recipient_cc']) . $mail_newline;
	if (isset($form['recipient_bcc']))
		$mail_header .= 'Bcc: ' . eregi_replace($email_replace_array,'',$form['recipient_bcc']) . $mail_newline;
	if (isset($form['priority']))
		$mail_header .= 'X-Priority: ' . ereg_replace($email_replace_array,'',$form['priority']) . $mail_newline;
	else
		$mail_header .= 'X-Priority: 3' . $mail_newline;
	$mail_header .= 'X-Mailer: PHPFormMail ' . VERSION . ' (http://www.boaddrink.com)' . $mail_newline;
	$mail_header .= 'X-Sender-IP: ' . eregi_replace($email_replace_array,'',getenv('REMOTE_ADDR')) . $mail_newline;
	$mail_header .= 'X-Referer: ' . eregi_replace($email_replace_array,'',getenv('HTTP_REFERER')) . $mail_newline;
	
	$form['subject'] = eregi_replace($email_replace_array,'',$form['subject']);
	
	if (eregi("MIME-|Content-|boundary", $mail_header . $mailbody . $form['subject']) == 0) {
		$mail_header .= 'Content-Type: text/plain; charset=utf-8' . $mail_newline;
		$mail_status = mail(eregi_replace($email_replace_array,'',$form['recipient']), $form['subject'], $mailbody, $mail_header);
		if (!$mail_status) {
			$errors[] = '1|Message could not be sent due to an error while trying to send the mail.';
			error_log('[PHPFormMail] Mail could not be sent due to an error while trying to send the mail.');
		} else {
			error_log('[PHPFormMail] Normal e-mail sent from IP ' . getenv('REMOTE_ADDR'));
		}
	} else {
			$mail_status = true;
			error_log('[PHPFormMail] Injection characters found from IP ' . getenv('REMOTE_ADDR') . '. Silently dropped');
	}
	return $mail_status;
}



function output_html($body)
{
	global $form;
	
	$bgcolor	= isset($form['bgcolor']) ? ('background-color: ' . htmlspecialchars($form['bgcolor']) . ';') : ('background-color: #FFF;');
	$background = isset($form['background']) ? ('background-image: url(' . htmlspecialchars($form['background']) . ');') : NULL;
	$text_color	= isset($form['text_color']) ? ('color: ' . htmlspecialchars($form['text_color']) . ';') : ('color: #000;');
	$link_color	= isset($form['link_color']) ? ('color: ' . htmlspecialchars($form['link_color']) . ';') : NULL;
	$alink_color	= isset($form['alink_color']) ? ('color: ' . htmlspecialchars($form['alink_color']) . ';') : NULL;
	$vlink_color	= isset($form['vlink_color']) ? ('color: ' . htmlspecialchars($form['vlink_color']) . ';') : NULL;
	
	print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
	print "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-US\" lang=\"en-US\">\n";
	print "<head>\n";
	print "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
	print "  <meta name=\"robots\" content=\"noindex,nofollow\" />\n";
	print "  <title>" . htmlspecialchars($form['title']) . "</title>\n";
	print "  <style type=\"text/css\">\n";
	print "    BODY {" . trim($bgcolor . ' ' . $text_color . ' ' . $background) . "}\n";
	if (isset($link_color))
		print "    A {" . $link_color . "}\n";
	if (isset($alink_color))
		print "    A:active {" . $alink_color . "}\n";
	if (isset($vlink_color))
		print "    A:visited {" . $vlink_color . "}\n";
	print "    h1 {font-size: 14pt; font-weight: bold; margin-bottom: 20pt}\n";
	print "    .crit {font-size: 12pt; font-weight: bold; color: #F00; margin-bottom: 10pt;}\n";
	print "    .returnlink {font-size: 12pt; margin-top: 20pt; margin-bottom: 20pt;}\n";
	print "    .validbutton {margin-top: 20pt; margin-bottom: 20pt;}\n";
	print "  </style>\n";
	if (isset($form['css']))
		print "  <link rel=\"stylesheet\" href=\"" . htmlspecialchars($form['css']) . "\">\n";
	print "</head>\n\n";
	print "<body>\n";
	print "<!-- PHPFormMail from http://www.boaddrink.com -->\n";
	print $body;
	//print "<div class=\"validbutton\"><a href=\"http://validator.w3.org/check/referer\" target=\"_blank\"><img src=\"http://www.w3.org/Icons/valid-xhtml10\" style=\"border:0;width:88px;height:31px\" alt=\"Valid XHTML 1.0!\" /></a></div>\n";
	print "</body>\n";
	print "</html>";
}


$form = decode_vars();

if (count($form) > 0) {
	
	// PFMA remove if block
	// Determine (based on the PHP version) if we should use the native
	// PHP4 in_array or the coded fake_in_array

	if (phpversion() >= '4.0.0')
		$in_array_func = 'in_array';
	else
		$in_array_func = 'fake_in_array';

	if($use_field_alias = isset($form['alias']))
		alias_fields();
	
	if(CHECK_REFERER == true)
		check_referer($referers);
	else
		error_log('[PHPFormMail] HTTP_REFERER checking is turned off.  Referer: ' . getenv('HTTP_REFERER') . '; Client IP: ' . getenv('REMOTE_ADDR') . ';', 0);

	// This is used for another variable function call
	if ((count($recipient_array) > 0) == true)
		$recipient_function = 'map_recipients';
	else
		$recipient_function = 'check_recipients';
	
	if (isset($form['recipient']))
		$form['recipient'] = $recipient_function($form['recipient']);
	if (isset($form['recipient_cc']))
		$form['recipient_cc'] = $recipient_function($form['recipient_cc']);
	if (isset($form['recipient_bcc']))
		$form['recipient_bcc'] = $recipient_function($form['recipient_bcc']);
	
	check_required();
	
	if (!$errors) {

		if (isset($form['sort']))
			sort_fields();

		if (isset($form['hidden'])) {
			// PFMA REMOVE 1
			$form['hidden'] = str_replace(' ', '', $form['hidden']);
			$form['hidden'] = explode(',', $form['hidden']);
			// PFMA ADD $form['hidden'] = array_map('trim', $form['hidden']);
		}

		if (send_mail()) {
			if (isset($form['redirect'])) {
				if (isset($form['redirect_values']))
					header('Location: ' . $form['redirect'] . '?' . getenv('QUERY_STRING') . "\r\n");
				else
					header('Location: ' . $form['redirect'] . "\r\n");
			} else {
				if (!isset($form['title']))
					$form['title'] = 'PHPFormMail - Form Results';
				$output = "<h3>Onderstaande informatie is verstuurd:</h3><ul>\n";
				reset($form);
				while (list($key,$val) = each($form)) {
					if ((!$in_array_func($key,$invis_array)) && ((isset($form['print_blank_fields'])) || ($val))) {
						$output .= '<div class="field"><b>';
						if(($use_field_alias) && ($form['alias_method'] != 'email'))
							$output .= htmlspecialchars($fieldname_lookup[$key]);
						else
							$output .= htmlspecialchars($key);
						if ((isset($form['hidden'])) && ($in_array_func($key,$form['hidden'])))
							$output .= ":</b> <i>(hidden)</i></div>\n";
						else
							$output .= ':</b> ' . nl2br(htmlspecialchars(stripslashes($val))) . "</div>\n";
					}
				}
				if (isset($form['return_link_url']) && isset($form['return_link_title']))
					$output .= '</ul><div class="returnlink"><br>Hartelijk dank voor uw reactie! Wij nemen uw idee&euml;n mee in onze productontwikkeling. Indien u zich heeft aangemeld voor de nieuwsbrief zetten wij u op de mailinglijst.<br><br><a href="' . $form["return_link_url"] . '">'. $form["return_link_title"] . "</a></div>\n";
					$verzending = "ok";					
  				output_html($output);				
				print "</ul><hr size='1'><br>";
				print "<font color='#FF2883'>Hartelijk dank voor uw reactie.<br>Wij nemen uw idee&euml;n mee in onze productontwikkeling. Indien u zich heeft aangemeld voor de nieuwsbrief zetten wij u op de mailinglijst.</font>";
					return $verzending;
			}
		}
	}
} else {
	$errors[] = '0|Nothing was sent by a form. (No data was sent by POST or GET method.)  There is nothing to process here.';
	error_log('[PHPFormMail] No data sent by POST or GET method. (' . getenv('HTTP_REFERER') . ')', 0);
}

if (count($errors) > 0)
	error();

?>

Ben benieuwd! Enneh, thanks.
 
Tha Devil, kan je er nog naar kijken?
Of iemand anders?

Ik zit er nog steeds mee... :(
 
Wat ik zo in de code kan zien is, ten eerste dat je het ergens gedownload hebt en ten tweede dat er waarschijnlijk een fout in de opbouw van je formulier zit.

Echter de fout vinden kan ik zo niet, ik zou graag willen weten waar je het script gedownload hebt zodat ik de documentatie kan bekijken :)
 
Bijgaand de versie maar dan met de opmerkingen van de schrijver erbij.
Het formulier heb ik niet zelf gedownload, en de website die bovenin genoemd wordt (had ik ook al gezien) levert mij niet zoveel meer op.
Ik zou natuurlijk te rade kunnen gaan bij degene die origineel het webformulier voor mij heeft gemaakt/gedownload, maar
a) daar vertrouw ik niet zo op omdat zij destijds basic vragen al niet goed kon beantwoorden b) kost geld c) ik krijg het nu liever zelf in de vingers.
Ik heb overigens de tuturial van Marjan (geloof ik) on PHP doorgenomen, begrijp er dus al meer van, maar nog lang niet alles.

PHP:
<?PHP
define('VERSION',****);
define('MANUAL','http://www.boaddrink.com/projects/phpformmail/readme.php');
define('CHECK_REFERER', true);

// +------------------------------------------------------------------------+
// | PHPFormMail                                                            |
// | Copyright (c) 1999 Andrew Riley (webmaster@boaddrink.com)              |
// |                                                                        |
// | This program is free software; you can redistribute it and/or          |
// | modify it under the terms of the GNU General Public License            |
// | as published by the Free Software Foundation; either version 2         |
// | of the License, or (at your option) any later version.                 |
// |                                                                        |
// | This program is distributed in the hope that it will be useful,        |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of         |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	See the           |
// | GNU General Public License for more details.                           |
// |                                                                        |
// | You should have received a copy of the GNU General Public License	    |
// | along with this program; if not, write to the Free Software            |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, |
// | USA.                                                                   |
// |                                                                        |
// +------------------------------------------------------------------------+
// |                                                                        |
// | If you run into any problems, pleas read the readme_formmail.txt.	    |
// | If that does not help, check out http://www.boaddrink.com.             |
// |                                                                        |
// | For more info, please visit http://www.boaddrink.com or read the       |
// | readme file included.                                                  |
// +------------------------------------------------------------------------+
// |                                                                        |
// | Value array fix by: Konrad Maqestieau                                  |
// | check_recipients reset() fix by: Don                                   |
// | servertime_offset code by: desolate                                    |
// |                                                                        |
// +------------------------------------------------------------------------+

// To change the address the e-mail comes from use define('FROM', 'Example Name <email@example.com>');
define('FROM', 'www.***.nl <info@***.nl>');

$referers = array('www.***.nl', '***.nl');

// $recipient_array format is $recipient_array = array('sometext'=>'email@example.com','asdf'=>'email2@example.com');
$recipient_array = array();

$valid_env = array('REMOTE_HOST', 'REMOTE_ADDR', 'REMOTE_USER', 'HTTP_USER_AGENT');

// +------------------------------------------------------------------------+
// | STOP EDITING! The only two required variables that need to be updated  |
// | are $referers and $valid_env                                           |
// +------------------------------------------------------------------------+

$errors = $fieldname_lookup = array();
$invis_array = array('recipient','subject','required','redirect',
		     'print_blank_fields','env_report','sort',
		     'missing_fields_redirect','title','bgcolor',
		     'text_color','link_color','alink_color',
		     'vlink_color','background','subject','title',
		     'link','css','return_link_title',
		     'return_link_url','recipient_cc','recipient_bcc',
				 'priority','redirect_values','hidden','alias',
         'mail_newline', 'gmt_offset', 'alias_method',
         'subject_prefix');

/****************************************************************
 * fake_in_array() is only used in PHP3 since PHP4 has a native	*
 * in_array.  Depending on what version of PHP you are running	*
 * the script will determine what is the best function to run 	*
 * --- THER IS NO LONGER ANY REASON TO DELETE THIS FUNCTION ---	*
 * Function renamed in 1.04.0					*
 ****************************************************************/

function fake_in_array($needle, $haystack)
{
	$found = false;
	while (list($key,$val) = each ($haystack)) {
		if ($needle == $val)
			$found = true;
	}
	return $found;
}

/****************************************************************
 * check_referer() breaks up the enviromental variable		*
 * HTTP_REFERER by "/" and then checks to see if the second	*
 * member of the array (from the explode) matches any of the	*
 * domains listed in the $referers array (declaired at top)	*
 ****************************************************************/

function check_referer($referers)
{
	global $errors;
	if (count($referers)) {
		if (getenv('HTTP_REFERER')) {
			$temp = explode('/', getenv('HTTP_REFERER'));
			$found = false;
			while (list(,$stored_referer) = each($referers)) {
				if (eregi('^' . $stored_referer . '$', $temp[2]))
					$found = true;
			}
			if (!$found) {
				$errors[] = '1|You are coming from an unauthorized domain.  Please read the manual section titled &quot;<a href="' . MANUAL . '#setting_up" target="_blank">Setting Up the PHPFormMail Script</a>&quot;.';
				error_log('[PHPFormMail] Illegal Referer. (' . getenv('HTTP_REFERER') . ')', 0);
			}
			return $found;
		} else {
			$errors[] = '0|Sorry, but I cannot figure out who sent you here.  Your browser is not sending an HTTP_REFERER.  This could be caused by a firewall or browser that removes the HTTP_REFERER from each HTTP request you submit.';
			error_log('[PHPFormMail] HTTP_REFERER not defined. Browser: ' . getenv('HTTP_USER_AGENT') . '; Client IP: ' . getenv('REMOTE_ADDR') . '; Request Method: ' . getenv('REQUEST_METHOD') . ';', 0);
			return false;
		}
	} else {
		$errors[] = '1|There are no referers defined.  All submissions will be denied.  Please read the manual section titled &quot;<a href="' . MANUAL . '#setting_up" target="_blank">Setting Up the PHPFormMail Script</a>&quot;.';
		error_log('[PHPFormMail] You have no referers defined.  All submissions will be denied.', 0);
		return false;
	}
}

/****************************************************************
 * check_recipients() breaks up the recipents e-mail addresses	*
 * and then crossrefrences the domains that are legal referers	*
 * Function added in 1.3.1                                      *
 ****************************************************************/

function check_recipients($recipient_list)
{
	global $errors, $referers;
	$recipients_ok = true;
	$recipient_list = explode(',', $recipient_list);
	while (list(,$recipient) = each($recipient_list)) {
		$recipient_domain = false;
		$recipient = trim($recipient);
		reset($referers);
		while ((list(,$stored_domain) = each($referers)) && ($recipient_domain == false)) {
			if (eregi('^[_\.a-z0-9-]*@' . $stored_domain . '$', $recipient))
				$recipient_domain = true;
		}
		if ($recipient_domain == false) {
			$recipients_ok = false;
			error_log('[PHPFormMail] Illegal Recipient: ' . $recipient . ' from ' . getenv('HTTP_REFERER'), 0);
		}
	}
/********************
Edit Bizziebee: Het valt mij op dat hierboven en hieronder nog verwezen wordt naar formmail, terwijl ik het document had hernoemd naar formmail_nieuwsbrief - ik heb dat in elk geval niet consequent overaal gedaan
*******************/
	if (!$recipients_ok)
		$errors[] = '1|You are trying to send mail to a domain that is not in the allowed recipients list.   Please read the manual section titled &quot;<a href="' . MANUAL . '#setting_up" target="_blank">Setting Up the PHPFormMail Script</a>&quot;.';
	return join(',', $recipient_list);
}

/****************************************************************
 * map_recipients() takes the array and maps them to the proper *
 * e-mail addresses from $recipient_array.  If this function is *
 * called then the e-mail addresses are not checked against the *
 * referer array.                                               *
 * Function added in 1.7.0                                      *
 ****************************************************************/

function map_recipients($recipient_list)
{
	global $errors, $recipient_array;
	$recipients_ok = true;
	$recipient_list = explode(',',$recipient_list);
	while (list(,$val) = each($recipient_list)){
		$val = trim($val);
		if(isset($recipient_array[$val]))
			$output[] = $recipient_array[$val];
		else
			$recipients_ok = false;
	}
	if (!$recipients_ok)
		$errors[] = '1|You are trying to send mail to an address that is not listed in the recipient array.';
	if (isset($output))
		return join(',', $output);
	else
		return null;
}

/****************************************************************
 * decode_vars() is used to assign all of the variables passed	*
 * into the form to a generic variable.  Allthough there are	*
 * two official form actions, POST and GET, I decided to use	*
 * this variable method so if more actions are invented, I	*
 * wouldn't have to change anything.				*
 *								*
 * In the first line, the request methood is assigned to	*
 * $request with HTTP_ and _VARS appended to it.		*
 * In the second line uses PHPs variable variable.		*
 * It's basically addressing the variable $HTTP_POST_VARS or	*
 * $HTTP_GET_VARS and returning that.  Read more about		*
 * variable variables in the PHP documentation.			*
 ****************************************************************/

function decode_vars()
{
	if (isset($_REQUEST))
		$request = '_' . getenv('REQUEST_METHOD');
	else
		$request = 'HTTP_' . getenv('REQUEST_METHOD') . '_VARS';
	global $$request;
	if (count($$request) > 0) {
		while (list($key, $val) = each($$request)) {
			if (is_array($val))
				$val = implode(', ',$val);
			$output[$key] = stripslashes($val);
		}
		return $output;
	} else
		return array();
}


/****************************************************************
 * error() is our generic error function.			*
 * When called, it checks for errors in the $errors array and	*
 * depending on $form["missing_fields_redirect"] will either	*
 * print out the errors by calling the function output_html()	*
 * or it will redirect to the location specified in		*
 * $form["missing_fields_redirect"].				*
 ****************************************************************/

function error()
{
	global $form, $natural_form, $errors;
	if (isset($form['missing_fields_redirect'])) {
		if (isset($form['redirect_values']))
			header('Location: ' . $form['missing_fields_redirect'] . '?' . getenv('QUERY_STRING') . "\r\n");
		else
			header('Location: ' . $form['missing_fields_redirect'] . "\r\n");
	} else {
		if(!isset($form['title']))
			$form['title'] = 'PHPFormMail - Error';
		$output = "<b><font color='#FF2883'>Er is een fout opgetreden:</b></font><ul>";
		$crit_error = 0;
		while (list(,$val) = each ($errors)) {
			list($crit,$message) = explode('|',$val);
			$output .= '  <li>' . $message . "</li>\n";
			if ($crit == 1)
				$crit_error = 1;
		}
		$output .= "</ul>\n";
		if ($crit_error == 1)
			$output .=  "<div class=\"crit\">Er zijn fouten geconstateerd die moeten worden verholpen door de webmaster. Het formulier wordt niet verzonden tot het probleem is opgelost.</div> Ga alstublieft <a href=\"javascript: history.back();\">terug naar het formulier</a> om dit goed in te vullen.\n";
		else
		  $foutmelding = "ja";
			$output .=  "<font color='#FF2883'>Vul de ontbrekende gegevens alstublieft nog in.</font><br>\n";
		  output_html($output);
			return $foutmelding;
	}
}
/****************************************************************
 * check_required() is the function that checks all required	*
 * fields to see if they are empty or match the provided regex	*
 * string (regex checking added in 1.02.0).			*
 *								*
 * Should a required variable be empty or not match the regex	*
 * pattern, a error will be added to the global $errors array.	*
 ****************************************************************/

function check_required()
{
	global $form, $errors, $invis_array, $fieldname_lookup;
	$problem = true;
	if ((!isset($form['recipient'])) && (!isset($form['recipient_bcc']))) {
		$problem = false;
		$errors[] = '1|There is no recipient to send this mail to.  Please read the manual section titled &quot;<a href="' . MANUAL . '#recipient" target="_blank">Form Configuration - Recipient</a>&quot;.';
		error_log('[PHPFormMail] There is no recipient defined from ' . getenv('HTTP_REFERER'), 0);
	}
	if (isset($form['required'])) {
		$required = split(',', $form['required']);
		while (list(,$val) = each($required)) {
			$val = trim($val);
			$regex_field_name = $val . '_regex';
			if ((!isset($form[$val])) || (isset($form[$val]) && (strlen($form[$val]) < 1))) {
				$problem = false;
				if (isset($fieldname_lookup[$val]))
					$field = $fieldname_lookup[$val];
				else
					$field = $val;
				$errors[] = '0|<b>' . $field . '</b> ontbreekt';
			} else if (isset($form[$regex_field_name])) {
				if (!eregi($form[$regex_field_name],$form[$val])) {
					$problem = false;
					$errors[] = '0|In <b>' . $fieldname_lookup[$val] . '</b> is een typefout gemaakt.';
				}
				$invis_array[] = $regex_field_name;
			}
		}
	}
	return $problem;
}


/****************************************************************
 * sort_fields() is responsable for sorting all fields in $form	*
 * depending $form["sort"].					*
 * There are three main sort methods: alphabetic, reverse	*
 * alphabetic, and user supplied.				*
 *								*
 * The user supplied method is formatted "order:name,email,etc".*
 * The text "order" is required and the fields are comma	*
 * sepperated. ("order" is legacy from the PERL version.) If	*
 * the user supplied method leaves fields out of the comma	*
 * sepperated list, the remaining fields will be appended to	*
 * the end of the orderd list in the order they appear in the	*
 * form.							*
 * Function added in 1.02.0					*
 ****************************************************************/

function sort_fields()
{
	global $form;
	switch ($form['sort']) {
		case 'alphabetic':
		case 'alpha':		ksort($form);
					break;
		case 'ralphabetic':
		case 'ralpha':		krsort($form);
					break;
		default:		if ($col = strpos($form['sort'],':')) {
						$form['sort'] = substr($form['sort'],($col + 1));
						$temp_sort_arr = explode(',', $form['sort']);
						for($x = 0; $x < count($temp_sort_arr); $x++) {
							$out[$temp_sort_arr[$x]] = $form[$temp_sort_arr[$x]];
							unset($form[$temp_sort_arr[$x]]);
						}
						$form = array_merge($out,$form);
					}
	}
	return true;
}


/****************************************************************
 * alias_fields() creates a lookup array so we can use Aliases	*
 * for the field names.	 If a alias is not available, the	*
 * lookup array is filled with the form field's name		*
 * Function added in 1.05.0					*
 ****************************************************************/

function alias_fields()
{
	global $form, $fieldname_lookup;
	while (list($key,) = each($form)) {
		$fieldname_lookup[$key] = $key;
	}
	reset($form);
	if (isset($form['alias'])) {
		$aliases = explode(',', $form['alias']);
		while (list(,$val) = each($aliases)) {
			$temp = explode('=', $val);
			$fieldname_lookup[trim($temp[0])] = trim($temp[1]);
		}
	}
	return true;
}


/****************************************************************
 * send_mail() the function that parses the data into SMTP	*
 * format and sends the e-mail.					*
 ****************************************************************/

function send_mail()
{
	global $form, $invis_array, $valid_env, $fieldname_lookup, $errors;
	
	$email_replace_array = "\r|\n|to:|cc:|bcc:";
	
	if (!isset($form['subject']))
			$form['subject'] = 'WWW Form Submission';
	if (isset($form['subject_prefix']))
			$form['subject'] = $form['subject_prefix'] . $form['subject'];
	if (!isset($form['email']))
			$form['email'] = 'email@example.com';
	
	switch ($form['mail_newline']) {
		case 2:		$mail_newline = "\r";
				break;
		case 3:		$mail_newline = "\r\n";
				break;
		default:	$mail_newline = "\n";
	}
	
	if (isset($form['gmt_offset']) && ereg('^(\\-|\\+)?([0-9]{1}|(1{1}[0-2]{1}))$', $form['gmt_offset'])) {
		$mkseconds = mktime(gmdate('H') + $form['gmt_offset']);
		$mail_date = gmdate('F jS, Y', $mkseconds) . ' at ' . gmdate('h:iA', $mkseconds) . ' (GMT ' . $form['gmt_offset'] . ').';
	} else
		$mail_date = date('F jS, Y') . ' at ' . date('h:iA (T).');
	
	if (isset($form['realname']))
		$realname = eregi_replace($email_replace_array,'',$form['realname']);
	elseif (isset($form['firstname']) || isset($form['lastname']))
		$realname = eregi_replace($email_replace_array,'',trim($form['firstname'] . ' ' . $form['lastname']));

	$mailbody = 'Via de website is het contactformulier ingevuld door:' . $mail_newline;
	if (isset($realname))
		$mailbody.= $realname . ' (' . $form['email'] . ').  ' . $mail_newline . $mail_newline;
	else
		$mailbody.= $form['email'] . '. '  . $mail_newline . $mail_newline;

	reset($form);
	
	while (list($key,$val) = each($form)) {
		if ((!in_array($key,$invis_array)) && ((isset($form['print_blank_fields'])) || ($val))) {
				if(($form['alias_method'] == 'email') || ($form['alias_method'] == 'both'))
					$mailbody .= $fieldname_lookup[$key];
				else
					$mailbody .= $key;
			$mailbody .= ': ' . $mail_newline . $val . $mail_newline;
		}
	}
	
	if (isset($form['env_report'])) {
		$temp_env_report = explode(',', $form['env_report']);
		$mailbody .= $mail_newline . $mail_newline . '-------- Technische gegevens van de afzender: --------' . $mail_newline;
		while (list(,$val) = each($temp_env_report)) {
			if (in_array($val,$valid_env))
					$mailbody .= eregi_replace($email_replace_array,'',$val) . ': ' . eregi_replace($email_replace_array,'',getenv($val)) . $mail_newline;
		}
	}

	if (!isset($form['recipient']))
		$form['recipient'] = '';

	// Append lines to $mail_header that you wish to be
	// added to the headers of the e-mail. (SMTP Format
	// with newline char ending each line)

	$mail_header = 'Return-Path: ' . eregi_replace($email_replace_array,'',$return_path) . $mail_newline;
	if (FROM != null)
		$mail_header .= 'From: ' . FROM . $mail_newline;
	$mail_header .= 'Reply-to: ';
	if (isset($realname))
		$mail_header .= $realname . ' <' . eregi_replace($email_replace_array,'',$form['email']) . '>' . $mail_newline;
	else
		$mail_header .= eregi_replace($email_replace_array,'',$form['email']) . $mail_newline;
	if (isset($form['recipient_cc']))
		$mail_header .= 'Cc: ' . eregi_replace($email_replace_array,'',$form['recipient_cc']) . $mail_newline;
	if (isset($form['recipient_bcc']))
		$mail_header .= 'Bcc: ' . eregi_replace($email_replace_array,'',$form['recipient_bcc']) . $mail_newline;
	if (isset($form['priority']))
		$mail_header .= 'X-Priority: ' . ereg_replace($email_replace_array,'',$form['priority']) . $mail_newline;
	else
		$mail_header .= 'X-Priority: 3' . $mail_newline;
	$mail_header .= 'X-Mailer: PHPFormMail ' . VERSION . ' (http://www.boaddrink.com)' . $mail_newline;
	$mail_header .= 'X-Sender-IP: ' . eregi_replace($email_replace_array,'',getenv('REMOTE_ADDR')) . $mail_newline;
	$mail_header .= 'X-Referer: ' . eregi_replace($email_replace_array,'',getenv('HTTP_REFERER')) . $mail_newline;
	
	$form['subject'] = eregi_replace($email_replace_array,'',$form['subject']);
	
	if (eregi("MIME-|Content-|boundary", $mail_header . $mailbody . $form['subject']) == 0) {
		$mail_header .= 'Content-Type: text/plain; charset=utf-8' . $mail_newline;
		$mail_status = mail(eregi_replace($email_replace_array,'',$form['recipient']), $form['subject'], $mailbody, $mail_header);
		if (!$mail_status) {
			$errors[] = '1|Message could not be sent due to an error while trying to send the mail.';
			error_log('[PHPFormMail] Mail could not be sent due to an error while trying to send the mail.');
		} else {
			error_log('[PHPFormMail] Normal e-mail sent from IP ' . getenv('REMOTE_ADDR'));
		}
	} else {
			$mail_status = true;
			error_log('[PHPFormMail] Injection characters found from IP ' . getenv('REMOTE_ADDR') . '. Silently dropped');
	}
	return $mail_status;
}


/****************************************************************
 * output_html() is used to output all HTML to the browser.	*
 * This function is called if there is an error or for the	*
 * "Thank You" page if neither are declaired as redirects.	*
 *								*
 * While called output_html() it actually outputs valid XHTML	*
 * 1.0 documents.						*
 * Function added in 1.02.0					*
 ****************************************************************/

function output_html($body)
{
	global $form;
	
	$bgcolor	= isset($form['bgcolor']) ? ('background-color: ' . htmlspecialchars($form['bgcolor']) . ';') : ('background-color: #FFF;');
	$background = isset($form['background']) ? ('background-image: url(' . htmlspecialchars($form['background']) . ');') : NULL;
	$text_color	= isset($form['text_color']) ? ('color: ' . htmlspecialchars($form['text_color']) . ';') : ('color: #000;');
	$link_color	= isset($form['link_color']) ? ('color: ' . htmlspecialchars($form['link_color']) . ';') : NULL;
	$alink_color	= isset($form['alink_color']) ? ('color: ' . htmlspecialchars($form['alink_color']) . ';') : NULL;
	$vlink_color	= isset($form['vlink_color']) ? ('color: ' . htmlspecialchars($form['vlink_color']) . ';') : NULL;
	
	print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n";
	print "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-US\" lang=\"en-US\">\n";
	print "<head>\n";
	print "  <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n";
	print "  <meta name=\"robots\" content=\"noindex,nofollow\" />\n";
	print "  <title>" . htmlspecialchars($form['title']) . "</title>\n";
	print "  <style type=\"text/css\">\n";
	print "    BODY {" . trim($bgcolor . ' ' . $text_color . ' ' . $background) . "}\n";
	if (isset($link_color))
		print "    A {" . $link_color . "}\n";
	if (isset($alink_color))
		print "    A:active {" . $alink_color . "}\n";
	if (isset($vlink_color))
		print "    A:visited {" . $vlink_color . "}\n";
	print "    h1 {font-size: 14pt; font-weight: bold; margin-bottom: 20pt}\n";
	print "    .crit {font-size: 12pt; font-weight: bold; color: #F00; margin-bottom: 10pt;}\n";
	print "    .returnlink {font-size: 12pt; margin-top: 20pt; margin-bottom: 20pt;}\n";
	print "    .validbutton {margin-top: 20pt; margin-bottom: 20pt;}\n";
	print "  </style>\n";
	if (isset($form['css']))
		print "  <link rel=\"stylesheet\" href=\"" . htmlspecialchars($form['css']) . "\">\n";
	print "</head>\n\n";
	print "<body>\n";
	print "<!-- PHPFormMail from http://www.boaddrink.com -->\n";
	print $body;
	//print "<div class=\"validbutton\"><a href=\"http://validator.w3.org/check/referer\" target=\"_blank\"><img src=\"http://www.w3.org/Icons/valid-xhtml10\" style=\"border:0;width:88px;height:31px\" alt=\"Valid XHTML 1.0!\" /></a></div>\n";
	print "</body>\n";
	print "</html>";
}


$form = decode_vars();

if (count($form) > 0) {
	
	// PFMA remove if block
	// Determine (based on the PHP version) if we should use the native
	// PHP4 in_array or the coded fake_in_array

	if (phpversion() >= '4.0.0')
		$in_array_func = 'in_array';
	else
		$in_array_func = 'fake_in_array';

	if($use_field_alias = isset($form['alias']))
		alias_fields();
	
	if(CHECK_REFERER == true)
		check_referer($referers);
	else
		error_log('[PHPFormMail] HTTP_REFERER checking is turned off.  Referer: ' . getenv('HTTP_REFERER') . '; Client IP: ' . getenv('REMOTE_ADDR') . ';', 0);

	// This is used for another variable function call
	if ((count($recipient_array) > 0) == true)
		$recipient_function = 'map_recipients';
	else
		$recipient_function = 'check_recipients';
	
	if (isset($form['recipient']))
		$form['recipient'] = $recipient_function($form['recipient']);
	if (isset($form['recipient_cc']))
		$form['recipient_cc'] = $recipient_function($form['recipient_cc']);
	if (isset($form['recipient_bcc']))
		$form['recipient_bcc'] = $recipient_function($form['recipient_bcc']);
	
	check_required();
	
	if (!$errors) {

		if (isset($form['sort']))
			sort_fields();

		if (isset($form['hidden'])) {
			// PFMA REMOVE 1
			$form['hidden'] = str_replace(' ', '', $form['hidden']);
			$form['hidden'] = explode(',', $form['hidden']);
			// PFMA ADD $form['hidden'] = array_map('trim', $form['hidden']);
		}

		if (send_mail()) {
			if (isset($form['redirect'])) {
				if (isset($form['redirect_values']))
					header('Location: ' . $form['redirect'] . '?' . getenv('QUERY_STRING') . "\r\n");
				else
					header('Location: ' . $form['redirect'] . "\r\n");
			} else {
				if (!isset($form['title']))
					$form['title'] = 'PHPFormMail - Form Results';
				$output = "<h3>Onderstaande informatie is verstuurd:</h3><ul>\n";
				reset($form);
				while (list($key,$val) = each($form)) {
					if ((!$in_array_func($key,$invis_array)) && ((isset($form['print_blank_fields'])) || ($val))) {
						$output .= '<div class="field"><b>';
						if(($use_field_alias) && ($form['alias_method'] != 'email'))
							$output .= htmlspecialchars($fieldname_lookup[$key]);
						else
							$output .= htmlspecialchars($key);
						if ((isset($form['hidden'])) && ($in_array_func($key,$form['hidden'])))
							$output .= ":</b> <i>(hidden)</i></div>\n";
						else
							$output .= ':</b> ' . nl2br(htmlspecialchars(stripslashes($val))) . "</div>\n";
					}
				}
				if (isset($form['return_link_url']) && isset($form['return_link_title']))
					$output .= '</ul><div class="returnlink"><br>Hartelijk dank voor uw reactie! Wij nemen uw idee&euml;n mee in onze productontwikkeling. Indien u zich heeft aangemeld voor de nieuwsbrief zetten wij u op de mailinglijst.<br><br><a href="' . $form["return_link_url"] . '">'. $form["return_link_title"] . "</a></div>\n";
					$verzending = "ok";					
  				output_html($output);				
				print "</ul><hr size='1'><br>";
				print "<font color='#FF2883'>Hartelijk dank voor uw reactie.<br>Wij nemen uw idee&euml;n mee in onze productontwikkeling. Indien u zich heeft aangemeld voor de nieuwsbrief zetten wij u op de mailinglijst.</font>";
					return $verzending;
			}
		}
	}
} else {
	$errors[] = '0|Nothing was sent by a form. (No data was sent by POST or GET method.)  There is nothing to process here.';
	error_log('[PHPFormMail] No data sent by POST or GET method. (' . getenv('HTTP_REFERER') . ')', 0);
}

if (count($errors) > 0)
	error();

?>

Wat ik heb aangepast t.o.v. het originele formulier (dat wel goed werkt), naast de velden zelf uiteraard, is:
- de bedank tekst op de returnpagina "Wij nemen uw ideeën mee in onze productontwikkeling. Indien u zich heeft aangemeld voor de nieuwsbrief zetten wij u op de mailinglijst."
- in de e-mail met gegevens naar mijzelf: alles onder elkaar, eerst veldnaam, daaronder de data, daaronder volgend veld etc. Origineel stond veldnaam en dat in 1 line (ik heb dus iets met linebreak aangepast, misschien zit daar een fout).
 
Heb je ook al eens met het originele script gewerkt?

Een kant-en-klaar script aanpassen zonder dat je echt een idee hebt wat je precies doet (ook al lijkt het onschuldig) is niet echt aan te raden.

Wat ik uit de documentatie kan op maken is dat je alles in kunt stellen met hidden formulier-elementen.

Vanaf hier worden alle instellingen uitgelegd welke er mogelijk zijn. Keuze genoeg lijkt mij?
 
Hai, nee, zomaar aanpassen is gevaarlijk - ik heb daarom de meeste aanpassingen ook in de html gedaan niet in PHP (waar ik minder vanaf weet). Ik heb de twee formulieren (origineel en aangepaste) nog eens met elkaar vergeleken (docs vergelijken in Word) en het enige dat gewijzigd is, is de "bedanktekst" op het terugkeerscherm en dus de wijze waarop het mailtje met data is opgemaakt. Alle andere wijzigingen zijn in html gedaan met verwijzing naar het PHP-formulier.

Dit is het stukje in formmail waarin ik de code heb aangepast m.b.t. velden/data onder elkaar in het mailtje in plaats van naast elkaar:
PHP:
/****************************************************************
 * send_mail() the function that parses the data into SMTP	*
 * format and sends the e-mail.					*
 ****************************************************************/

function send_mail()
{
	global $form, $invis_array, $valid_env, $fieldname_lookup, $errors;
	
	$email_replace_array = "\r|\n|to:|cc:|bcc:";
	
	if (!isset($form['subject']))
			$form['subject'] = 'WWW Form Submission';
	if (isset($form['subject_prefix']))
			$form['subject'] = $form['subject_prefix'] . $form['subject'];
	if (!isset($form['email']))
			$form['email'] = 'email@example.com';
	
	switch ($form['mail_newline']) {
		case 2:		$mail_newline = "\r";
				break;
		case 3:		$mail_newline = "\r\n";
				break;
		default:	$mail_newline = "\n";
	}
	
	if (isset($form['gmt_offset']) && ereg('^(\\-|\\+)?([0-9]{1}|(1{1}[0-2]{1}))$', $form['gmt_offset'])) {
		$mkseconds = mktime(gmdate('H') + $form['gmt_offset']);
		$mail_date = gmdate('F jS, Y', $mkseconds) . ' at ' . gmdate('h:iA', $mkseconds) . ' (GMT ' . $form['gmt_offset'] . ').';
	} else
		$mail_date = date('F jS, Y') . ' at ' . date('h:iA (T).');
	
	if (isset($form['realname']))
		$realname = eregi_replace($email_replace_array,'',$form['realname']);
	elseif (isset($form['firstname']) || isset($form['lastname']))
		$realname = eregi_replace($email_replace_array,'',trim($form['firstname'] . ' ' . $form['lastname']));

	$mailbody = 'Via de website is het contactformulier ingevuld door:' . $mail_newline;
	if (isset($realname))
		$mailbody.= $realname . ' (' . $form['email'] . ').  ' . $mail_newline . $mail_newline;
	else
		$mailbody.= $form['email'] . '. '  . $mail_newline . $mail_newline;

	reset($form);
	
	while (list($key,$val) = each($form)) {
		if ((!in_array($key,$invis_array)) && ((isset($form['print_blank_fields'])) || ($val))) {
				if(($form['alias_method'] == 'email') || ($form['alias_method'] == 'both'))
					$mailbody .= $fieldname_lookup[$key];
				else
					$mailbody .= $key;
				$mailbody .= ': ' . $mail_newline . $val . $mail_newline;
/**************** 
/hierboven staat 2x mailnewline, de eerste heb ik zelf toegevoegd, 
de rest is origineel
**********/
		}
	}
	
	if (isset($form['env_report'])) {
		$temp_env_report = explode(',', $form['env_report']);
		$mailbody .= $mail_newline . $mail_newline . '-------- Technische gegevens van de afzender: --------' . $mail_newline;
		while (list(,$val) = each($temp_env_report)) {
			if (in_array($val,$valid_env))
					$mailbody .= eregi_replace($email_replace_array,'',$val) . ': ' . eregi_replace($email_replace_array,'',getenv($val)) . $mail_newline;
		}
	}

Maar eigenlijk heb ik, al puzzelend het idee, dat de fouten niet met PHP te maken hebben.
In de mail komt het veld 'nieuwsbrief; netjes te staan, alleen dubbel (zie originele probleemstelling).
En op het terugkeerscherm komt ook netjes de output (echo) e.d. te staan, "alleen" de schermopbouw is gecorrumpeerd.

Iemand met een frisse blik?
 
Probleem 2 met 'dubbele' velden is opgelost: ik heb het formulier gewoon nog een keer gemaakt en netjes opnieuw opgebouwd. Ik denk dat ik toch iets met het benoemden van velden en toekennen van values verkeerd had gedaan.

Probleem 1 met wat ik noem, het verschoven 'frame' bestaat nog steeds.
Het lijkt wel alsof hij de pagina halverwege opnieuw gaat opbouwen en daardoor de kantlijn naar rechts verschuift.
 
Probleem 1 ook opgelost.
Het menu (waarvan ik de code niet hier had geplaatst, alleen de code m.b.t. het formulier had ik gepost) verwees naar een onjuist actief menu. Dit heb ik aangepast en nu is de schermopbouw correct.
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan