mercredi 10 juin 2015

If condition doesn't allow to leave empty fields

I have the contact form, where you can add multiple recipients, but when i uploaded it on a server, there was these errors:

Notice: Undefined index: recipient in /var/www/vhosts/partizanas.lt/httpdocs/brief/contactform.php on line 17 Notice: Undefined index: recipient0 in /var/www/vhosts/partizanas.lt/httpdocs/brief/contactform.php on line 18 Notice: Undefined index: recipient1 in /var/www/vhosts/partizanas.lt/httpdocs/brief/contactform.php on line 19 Notice: Undefined index: recipient2 in /var/www/vhosts/partizanas.lt/httpdocs/brief/contactform.php on line 20 Notice: Undefined index: recipient3 in /var/www/vhosts/partizanas.lt/httpdocs/brief/contactform.php on line 21 Notice: Undefined index: email in /var/www/vhosts/partizanas.lt/httpdocs/brief/contactform.php on line 22"

i wrote the if condition which fixes the errors:

if (isset($_POST['Submit']))    
{    

$formproc->AddRecipient($_POST["recipient"]); 
$formproc->AddRecipient($_POST["recipient0"]); 
$formproc->AddRecipient($_POST["recipient1"]); 
$formproc->AddRecipient($_POST["recipient2"]); 
$formproc->AddRecipient($_POST["recipient3"]);  
$formproc->AddRecipient($_POST["email"]); 
} 

but the problem is, the form isnt sent if there are empty input fields. And i want it to send the form when not all the fields are filled.

Any advice how to do it?

Aucun commentaire:

Enregistrer un commentaire