issues calling function in PHP
<p>I'm trying to call a function that catches variables value on call:</p>

<p><strong>the function:</strong></p>

<pre><code>function check_input_data($INCLUDE_DISABLEDd_types = '', $field1 = '', $field2 = '', $field3 = '', $field4 = '', $field5 = '', $field6 = '', $field7 = '', $field8 = '')
{
    if ( !empty( $INCLUDE_DISABLEDd_types ) )
    {
        global $field1, $field2, $field3, $field4, $field5, $field6, $field7, $field8, $field_1_status, $field_2_status, $field_3_status, $field_4_status, $field_5_status, $field_6_status, $field_7_status, $field_8_status;
        if ( $INCLUDE_DISABLEDd_types == 'email_u' )
        {
            echo "It's noticed the INCLUDE_DISABLEDd var";
            if ( !empty( $field1 ) )
            {
                //I'll tell you what to do later
            }
            if ( !empty( $field2 ) )
            {
                echo $field2;
                if ( preg_match( "/[^-a-z0-9_]/i", $field2 ) )
                {
                    $field_2_status = true;
                    $ff = "good input?";
                }
                else if ( !preg_match( "/[^-a-z0-9_]/i", $field2 ) )
                {
                    $field_2_status = true;
                    $ff = "bad input?";
                }
                else
                {
                    $ff= "something is wrong with preg match";
                }
                echo $ff;
            }
        }
    }
}
</code></pre>

<p>Okay so as you can see, the function will look for only 3 different variables(for now). If it finds them, it will do something.</p>

<p>Now here is the call the the function:</p>

<pre><code>check_input_data ('email_u', 'test1', 'LOOK FIELD TWO IS HERE');
</code></pre>

<p>Now the first var in the function call is for <code>$included_types</code> the second for <code>$field1</code> and the third for <code>$field2</code>.</p>

<p>For some reason, the first var (<code>$included_types</code>) which i give a value of <code>email_u</code> is detected but the rest (<code>$field1</code> and <code>$field2</code>) is not.</p>

<p>The reason i know the first var (<code>$included_types</code>) is detected is because it echo's out "It's noticed the included var".</p>

<p>As you can see, I've got an if statement to check if <code>$field2</code> is empty and if it's not then i tell it to echo the var. Now it doesn't execute any code because it thinks <code>$field2</code> is empty (when its not) so i then change the if statement to do the task if it IS empty and it does it but it echos <code>$field2</code> with absolutely nothing so i know its not the empty function.</p>

<p>It somehow thinks <code>$field2</code> is empty.</p>

<p>I've also tried giving values for ALL vars:</p>

<pre><code>check_input_data ('email_u', 'test1', 'LOOK FIELD TWO IS HERE', 'test', 'test', 'test', 'test', 'test', 'test');
</code></pre>

<p>but it still only picks up the first var, not the rest.</p>

<p>Have I completely mis-understood something? or is there something wrong with the code?</p>

<p>thanks</p>
