Welcome Guest, Not a member yet? Register   Sign In
Undefined variable: message?
#1

[eluser]anna16[/eluser]
Why I am having this strange error?

Undefined variable message? in my view form?

controller: site.php
Code:
more codes here....
    function recover_userpass()
    {
        //fetch username and password from database
        $data = array();
    $data = $this->membership->get_userpass($this->input->post('email'));

        if(isset($data[1])) //if not empty, email username and password to user
        {
            echo 'user: ', $data[0];
            echo '<br>pass: ', $data[1];
            echo '<br>email: ', $this->input->post('email');
        }
        else //else set error message
        {
            $data['message'] = "The email address  you've entered does not exist.";
            $this->load->view('membership/email_userpass_form', $data);
        }
    }

more codes here....

view: email_userpass_form.php
Code:
&lt;head&gt;
&lt;title&gt;User and password recovery.&lt;/title&gt;
&lt;/head&gt;
&lt;body bgcolor="#666666"&gt;
<table  bgcolor="#FFFFFF"  cellspacing="6">
<tr><td>
&lt;?php echo form_open('membership/site/recover_userpass'); ?&gt;
  <fieldset>
    <legend><b>User and password recovery</b></legend>
    &lt;input type="text" name="email" value="Email" size="25"&gt;&lt;br>
    <div>&lt;input type="Submit" value="Submit" /&gt;&lt;/div>
  </fieldset>  
&lt;?php echo form_close(); ?&gt;
</td></tr>
</table>
<br>
&lt;?php echo $message; ?&gt;
<br>
&lt;?php echo validation_errors(); ?&gt;
&lt;/body&gt;
&lt;/html&gt;

Thanks in advanced.
#2

[eluser]anna16[/eluser]
Hi guys

Can someone please delete this thread.
I accidentally press the 'submit post' button twice.
#3

[eluser]SPeed_FANat1c[/eluser]
I cannot see where the bug is, it all looks ok there. These situations suck when such simple thing cannot work Smile
Is this a function you call in url, or is there another function which calls recover_userpass()? I think you should post more code.




Theme © iAndrew 2016 - Forum software by © MyBB