hi , i have a simple form in and i am using post method to pass textbox values to second page , but the post method doesnt seem to work at all , i tried almost evrything but it is not working , i need help
- <form action="index.php" method="POST">
- <table>
- <tr>
- <td><label>Username</label></td>
- <td><input type="text" name="uname"/></td>
- </tr>
- <tr>
- <td><label>Password</label></td>
- <td><input type="password" name="pword"/></td>
- </tr>
- <tr>
- <td><label>Confirm Password</label></td>
- <td><input type="password" name="cpword"/></td>
- </tr>
- </table>
- <input type="submit" Value="Login"/>
- </form>
and below is the second php file (where i am trying to acces POST)
- <?php
- if(isset($_POST["uname"]))
- { $usernamep = $_POST["uname"];
- echo "$username";
- }
- if(isset($_POST["pword"]))
- $passwordp = $_POST["pword"];
- if(isset($_POST["cpword"]))
- $confirmp = $_POST["cpword"];
- $connection = mysqli_connect('localhost','something','something','collegedb');
- if(!$connection)
- {
- die("some problem occured while connecting.");
- }
- $query = "select * from users where UserName='".$usernamep."'and UserPassword='".$passwordp."'";
- $result = mysqli_query($connection,$query);
- if(mysqli_num_rows($result)>0)
- {
- session_start();
- $_SESSION['currentuser'] = $usernamep;
- header('Location:http://localhost/home/');
- }
- else
- echo "No Rows Found !";
- ?>
here is the error my chrome shows :>
Notice: Undefined variable: usernamep in C:\xampp\htdocs\home\index.php on line 20
Notice: Undefined variable: passwordp in C:\xampp\htdocs\home\index.php on line 20
No Rows Found !