New to .php so need script help.
I want to know how to stop this being displayed when I click submit.
Notice: Undefined index: homeowner in E:\domains\r\.. .\user\htdocs\. ..\form.php on line 166
I have an array which takes filled in fields and blank fields and sends them via email.
I DON'T need the user to fill in all the fields which is resulting in this notice on every field that is not filled in. I do need the fields to be sent tho' even if blank.
I have posted the scipt i have managed to piece together if this will help.
somehow I need the blank fields not to show me this notice.
I have started my .php script with this
Sorry, but completey new to .php so I have no idea what i have to do to stop this notice from displaying, or how to script it into the above.
Any help will be appreciated.
I want to know how to stop this being displayed when I click submit.
Notice: Undefined index: homeowner in E:\domains\r\.. .\user\htdocs\. ..\form.php on line 166
I have an array which takes filled in fields and blank fields and sends them via email.
I DON'T need the user to fill in all the fields which is resulting in this notice on every field that is not filled in. I do need the fields to be sent tho' even if blank.
I have posted the scipt i have managed to piece together if this will help.
somehow I need the blank fields not to show me this notice.
I have started my .php script with this
Code:
<?php
$to = $_REQUEST['sendto'] ;
$from = $_REQUEST['Email'] ;
$name = $_REQUEST['Member_Name'] ;
$headers = "From: $from";
$subject = "......";
$fields = array(); //I HAVE ABOUT 100 FIELDS
$body = ".........:\n\n"; foreach($fields as $a => $b){ $body .= sprintf("%20s: %s\n",$b,$_REQUEST[$a]); }
$headers2 = "From: .......@.....";
$subject2 = "Thank-you .......";
$autoreply = "Somebody.......";
if($from == '') {print "You have not ....";}
else {
if($name == '') {print "You have not .......";}
else {
$send = mail($to, $subject, $body, $headers);
$send2 = mail($from, $subject2, $autoreply, $headers2);
if($send)
{header( "Location: http.....com/.../thankyou.html" );}
else
{print "We encountered an error sending your mail, please notify ...@...."; }
}
}
?>
Any help will be appreciated.
Comment