Jump to content

Need help please


Go to solution Solved by benanamen,

Recommended Posts

So, I am trying to create a website where you enter a pin, it redirects you to a page, enter another pin, it redirects you to another page.
I have two files:
th1.php   (the main file)

<?php //require_once"app/init.php ;?>
<!DOCTYPE HTML>

<link rel="stylesheet" type="text/css" href="style.css" /> 

<form action="th.php" method="POST">


  <div class="container">

    <input type="text" placeholder="Enter PIN" name="pin" required>



    <button type="submit" name="sub" value="Submit">Submit</button>

  </div>



  <div class="container" style="background-color:#f1f1f1">

  </div>

</form>

and th.php (the verification file)

<?php
if(isset($POST['pin']) AND !empty($POST['pin'])){
$input = $_POST['pin'];
$pinI = "6203";
$pinII = "9471";
if($input === $pinI){
header("Location:pinI.html");
}else{
if($input === $pinII){
header("Location:pinII.html");
}else{
echo "PIN INCORRECT!";
}}

}else{
echo "PIN EMPTY!";
}

but any code I insert, even the correct one, it sais PIN EMPTY!

 

can you help me please?

Edited by AlexejheroYTB
Link to comment
https://forums.phpfreaks.com/topic/303052-need-help-please/
Share on other sites

It still says PIN EMPTY!

my code now:

<?php
if(isset($POST['pin']) AND !empty($POST['pin'])){
$input = $_POST['pin'];
$pinI = "6203";
$pinII = "9471";
if($input == $pinI){
header("Location:pinI.html");
}else{
if($input == $pinII){
header("Location:pinII.html");
}else{
echo "PIN INCORRECT!";
}}

}else{
echo "PIN EMPTY!";
}
Link to comment
https://forums.phpfreaks.com/topic/303052-need-help-please/#findComment-1542088
Share on other sites

the variable names are correct

<?php
if(isset($POST['pin']) AND !empty($POST['pin'])){
$input = $_POST['pin'];
$pinI = "6203";
$pinII = "9471";
if($input == $pinI){
header("Location:pinI.html");
}else{
if($input == $pinII){
header("Location:pinII.html");
}else{
echo "PIN INCORRECT!";
}}

}else{
echo "PIN EMPTY!";
}
Edited by AlexejheroYTB
Link to comment
https://forums.phpfreaks.com/topic/303052-need-help-please/#findComment-1542090
Share on other sites

this is the code that works:

<?php
if(isset($_POST['pin']) AND !empty($_POST['pin'])){
$input = $_POST['pin'];
$pinI = "6203";
$pinII = "9471";
if($input == $pinI){
header("Location:pinI.html");
}else{
if($input == $pinII){
header("Location:pinII.html");
}else{
echo "PIN INCORRECT!";
}}

}else{
echo "PIN EMPTY!";
}
?>
Link to comment
https://forums.phpfreaks.com/topic/303052-need-help-please/#findComment-1542095
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.