Why am I getting an "Undefined variable" notice in PHP?
<p>So I have the following:</p>

<pre><code>&lt;?php
    show_form();
?&gt;


&lt;form id="add" method="post" action="addIssue.php"&gt;
    Name:
    &lt;?php input_text('name','str_name', $defaults , '1'); ?&gt;
    &lt;input class="submit" type="submit" value="Begin download" /&gt;
    &lt;input type="hidden" name="_submitCheck" value="1"/&gt; 
&lt;/form&gt;


&lt;?php
function show_form($errors = '') 
{ 
    // If form is submitted, get the defaults from submitted parameters
    if(empty($_POST['_submitCheck']) OR !$_POST['_submitCheck'] ){
     // set our own defaults
     $defaults = array('str_name' =&gt; '');

    } else {
     $defaults = $_POST;
    }
} 

// Echo text box
function input_text($elem_id, $element_name, $values, $tab='') {
    echo '&lt;input id="'.$elem_id.'" name="'.$element_name.'"';
    echo ' tabindex="'.$tab.'" class="text" value="';
    echo htmlentities($values[$element_name]) . '" /&gt;';
}
?&gt;
</code></pre>

<p>Why am I getting the following Notice?</p>

<p><code>Notice: Undefined variable: defaults</code></p>
