Hi all,
I have set up a contact form and 8 out of 10 come back blank. When I test it it comes back fine, but for some reason every few days I get emailed a blank form from my contact us.
Can someone please look at my following send file code to see if I have done anything wrong.
Thanks
PHP Code:
<?php //--------------------------Set these paramaters--------------------------[/FONT] [FONT=Calibri]// Subject of email sent to you. $subject = 'Results from Contact form'; [/FONT] [FONT=Calibri]// Your email address. This is where the form information will be sent. $emailadd = [EMAIL="'admin@thai-discovery.com'"]'admin@thai-discovery.com'[/EMAIL]; [/FONT] [FONT=Calibri]// Where to redirect after form is processed. $url = 'http://www.thai-discovery.com'; [/FONT] [FONT=Calibri]// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty. $req = '0'; [/FONT] [FONT=Calibri]// --------------------------Do not edit below this line-------------------------- $text = "Results from form:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?>
Last edited by chrishirst; 10-21-2009 at 06:44 AM..
|