-1
First, I made two forms with an input of type Hidden each:
<form action="painel.php" method="POST">
<input type="hidden" value="aluno" name = "auth">
<input type="submit" value="Aluno">
</form>
<br>
<form action="painel.php" method="POST">
<input type="hidden" value="adm" name = "auth">
<input type="submit" value="Adm">
</form>
Afterwards, I tried to get the value of a Hidden input at the beginning of the page "dashboard.php":
<?php
session_start();
$auth = $_POST['auth'];
?>
But this problem arises:
Warning: Undefined array key "auth" in C: xampp htdocs sites panel work.php on line 3
What I do?
If you take the
hidden
, he sends right?– ThRnk
The error message itself is telling you what to do. Give an echo '<pre>'; print_r($_POST); or a var_dump($_POST); in.php panel and see what you’re submitting in the form.
– Marcos Xavier
Thrnk, I don’t know how to do without Hidden, because I need this information to check the login information in the database, if it’s student it checks in the student table and if it’s Adm it checks in the Adm table.
– Thauan Fernandes Araújo
Marcos Xavier, I gave an echo and a print_r but gave the same problem.
– Thauan Fernandes Araújo
What if you leave together the same (=)? What is so
name = "auth"
so that wayname="auth"?
– adventistaam
Adventistaam, it worked kkkkk I don’t even know how
– Thauan Fernandes Araújo
Thank you to everyone who tried to help me, have a good day.
– Thauan Fernandes Araújo
This does not interfere with anything in php, I believe it is some other change you have made in your code. Take the test as it was before and put it here. I am using php 7.3
– Marcos Xavier
@Thauanfernandesaraújo I’m glad it worked out
– adventistaam
I use php 8.0.2, I put it the way it was before and it worked. I don’t know what it was
– Thauan Fernandes Araújo
Beware of rsrs caches
– adventistaam