TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Arslan Ali
NA
69
11.5k
Post method not working
Jul 8 2018 12:40 AM
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 !
Reply
Answers (
1
)
the server responded with a status 405
Integration angular js component with existing php app