Problem with blocking of messages to be sent on the form

I have a PHP form 5 required fields, 3 of which are in the drop-down menus.

To validate fields, I created the following tables:

required fields
$required is array ('username', 'subscriber_name', 'report_type', 'rpt_delivery_frequency', 'look_back_time');.

Empty array all the missing fields
$missing = array();

Then the variables $_POST are treated:

foreach ($_POST as $key = > $value) {}
$temp = is_array ($value)? $value: trim ($value);
If (empty ($temp) & & in_array ($key, $required)) {}
return ($manquant, $key);
}
{} else if (in_array ($key, $expected))
${$key} = $temp;
}
}

So, if a required field is empty its name attribute is added to the $missing table. (This code is a bit beyond my knowledge of PHP; I received this book PHP Solutions).

Text fields were easy to validate. The drop down menus were a bit difficult. After some trial and error, I came with a validation code to my drop-down menus. Here is the validation code for the type of report:

<? PHP
If (sizeof ($report_type) == 0 | in_array ($_POST ['report_type'], $report_type_choices)) {}
} else {? >}
< p > < span class = "WARNING" > please select a report Type. </span > < /p > <? PHP
}
? >

It works in what concerns the validation if a valid election has been selected in the dropdown in the report Type field. The user must select Standard or custom to not get the warning text. THE PROBLEM is that if nothing has been selected, I have the warning text BUT even when the MAIL IS SENT.

Of course, mail is sent because the report_type required field is not empty, it has the value "select_one".

But how can I stop mail from being sent to less Standard or customized are selected for the report Type field?

If you have a value = "", it will work. " However, if there is no value attribute in the

Tags: Dreamweaver

Similar Questions

Maybe you are looking for

  • Extensions Google Crome

    There are an extension on Google Chrome which I love, but is not available on Firefox, so I would like to know if there is a way to use a Chrome extension in Firefox. I have Firefox 8 and that the extension is the only reason why I open Chrome someti

  • Portege M100: USB mouse is crazy

    Hello I want to kill them and disable the built-in mouse of my M100 because it is completely crazy.It moves by itself and when I connect a USB mouse and I'm trying to control the cursor, it does not stop the movement. In fact, there is a problem with

  • How to transfer windows mail messages to my gmail account?

    I am hoping that someone can help me to access my emails in my windows email account via my gmail account. I went through the whole upward in gmail, but unfortunately he didn't seem to have worked. Thank you very much

  • Reference Dell V313w does not print

    First of all I apologize if it is redundant. I spent countless hours scouring the web for answers and have not found anything to solve my problem. I looked in the forums as best as I can, but nothing helped. I'm having a problem with a Dell V313w whi

  • AUSWECHSELN in RAID5 DI a HD SAS 2.5 GRIPS 10 k ONE CON ALTRO DA 15 K - URGENTISSIMO [DS]

    HO NEED DI SAPER SE POSSO AUSWECHSELN ALL'INTERNO DI a RAID5 UN HD SAS 2.5 GRIPS 10 k CON ONE ALTRO DA 15 K SENZA AVERE PROBLEMI. DELL T710 FYTHY4J SERVER HD ST9146803SS URGENTISSIMO