MoonCoffee
Programmer
- Sep 17, 2012
- 4
Hi,
I'm having problem added new input data in html entry form but was not received in email, what is going wrong?
Created another input "Company" (no validation needed) in form entry. Please show me how to edit from original contact.php in order to receive the company input data from email. Being trying long hours but still can not figure out, please help.
Thank you very much.
below is the original contact.php :-
$values = array ('name','email','message');
$required = array('name','email','message');
$your_email = "name@gmail.com";
$email_subject = "New Message";
$email_content = "new message:\n";
//for( $i = 0 ; $i < count( $values ) ; ++$i ) {
// for( $c = 0 ; $c < count( $required ) ; ++$c ) {
// if( $values[$i]==$required[$c] ) {
// echo $required[$x];
// if( empty($_POST[$values[$i]]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
// }
// }
// $email_content .= $values[$i].': '.$_POST[$values[$i]]."\n";
//}
foreach($values as $value){
if(in_array($value,$required)){
if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
$email_content .= $value.': '.$_POST[$value]."\n";
}
$_POST['message'];
}
if(mail($your_email,$email_subject,$email_content)) {
echo 'Message sent!';
} else {
echo 'ERROR!';
}
}
?>
I'm having problem added new input data in html entry form but was not received in email, what is going wrong?
Created another input "Company" (no validation needed) in form entry. Please show me how to edit from original contact.php in order to receive the company input data from email. Being trying long hours but still can not figure out, please help.
Thank you very much.
below is the original contact.php :-
$values = array ('name','email','message');
$required = array('name','email','message');
$your_email = "name@gmail.com";
$email_subject = "New Message";
$email_content = "new message:\n";
//for( $i = 0 ; $i < count( $values ) ; ++$i ) {
// for( $c = 0 ; $c < count( $required ) ; ++$c ) {
// if( $values[$i]==$required[$c] ) {
// echo $required[$x];
// if( empty($_POST[$values[$i]]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
// }
// }
// $email_content .= $values[$i].': '.$_POST[$values[$i]]."\n";
//}
foreach($values as $value){
if(in_array($value,$required)){
if( empty($_POST[$value]) ) { echo 'PLEASE FILL IN REQUIRED FIELDS'; exit; }
$email_content .= $value.': '.$_POST[$value]."\n";
}
$_POST['message'];
}
if(mail($your_email,$email_subject,$email_content)) {
echo 'Message sent!';
} else {
echo 'ERROR!';
}
}
?>