Can anyone help me with html forms in php on google app engine. I have two files, first file sends username and password to second file, and that second file should display appropriate message.
This is first.html
<html>
<body>
<form action="hello.php" method="POST">
<b>Username: </b> <input type="text" name="username"> <br>
<b>Password: </b> <input type="text" name="password"> <br>
<input type="submit">
</form>
</body>
</html>
This is hello.php (second file):
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if($password == 'user' and $password =='pass')
echo 'Success';
else
echo 'Fail';
?>
When I press Submit button in first.html my two textboxes just goes blank and my link changes, but I don't see any message.If I run hello.php manually then it shows message.
Try adding this to app.yaml, before your main URI handler
- url: /hello.php*
script: hello.php
This is weird. $password
cant hold both values ta the same time
if($password == 'user' and $password =='pass')
should probably be
if($username == 'user' && $password =='pass')
change the content of Hello.php file with this
<?php
$username = $_POST['username'];
$password = $_POST['password'];
if($username == 'user' && $password =='pass')
{
echo 'Success';
}
else
{
echo 'Fail';
}