Organizational Research By

Surprising Reserch Topic

Experts Most Trusted Topic


undefined index in zend framework


undefined index in zend framework  using -'php,zend-framework'

Here is my simple form:

<form action = "input" method = "POST">
Name: <input type="text" name="uname"/> <br>
<input type="submit" name="button" value="hit it" >
</form>


Here is my controller:

public function indexaction()
{
    $db= new DataBase();
    $db->initDB("testform", "benjaminsform");
    $con=mysqli_connect("localhost","root","","benjaminsform");
    if($_SERVER["REQUEST_METHOD"]=="POST"){
        if(isset($_POST["button"])) {
            $uname=$_POST['uname'];
        }
        $success=$db->insert(array("name"=>$uname));
    }

    return array();
}


And this is the error im receiving"


  Notice: Undefined variable: uname in /usr/local/zend/var/apps/http/v-hrswebapps/80/benjamintestapp/1.0.0_201/module/Application/src/Application/Controller/IndexController.php on line 27
  
  Line 27 the one in question is the $success statement.


Ive tried working with my isset statements but nothing is really passing into the array.
    

asked Oct 23, 2015 by rajeshujade
0 votes
2 views



Related Hot Questions



Walkin Jobs Opening



Government Jobs Opening


...