I am getting a notice in code igniter and am not sure of how to get rid of it. I have an admin.php view file with the following relevant code:
Admin page
<p><strong><div id="myErr">
<?php
echo "$myError";
?>
</div>
</strong></p>
I have an Admin.php control file with the following relevant code:
public function addPerson()
{
// GET AND SET POSTED DATA
$username = $this->input->post('username');
$password = $this->input->post('password');
$accesslevel = $this->input->post('accesslevel');
$myerror = "";
// add the person to database with
if (strlen($username) < 1)
{
$myerror = "The Username field is required.";
}
if(strlen($myerror)==0)
{
$this->db->query("INSERT INTO usersas6 "."(compid,username,password,accesslevel) VALUES "."(null,'$username', '$password', '$accesslevel')");
$this->getAllPerson();
$this->template->show('Admin', $this->TPL);
}
if(strlen($myerror) != 0){
$this->TPL["myError"] = $myerror;
$this->getAllPerson();
$this->template->show('Admin', $this->TPL);
}
}
The setup actually works when I submit the relevant form. The error output appears! But there is this warning message on the loaded page (prior to submitting the form) and I am not sure how to get rid of it.