0
Im not able to didplay the output data which i got through a form ...(form being submitted to itself)...help me out
4 Respuestas
+ 2
I think he means that the informations (data) are being sent to the same page and not a different one. but as Daniel said, post your code so that people could help you out
+ 1
Best would be if you'd post / create your code here or code playground. That way it's easier to detect an error.
What do you mean you post the form to itself by the way? 🤔
+ 1
there is a syntax error in the second if statement. You do not have to put each condition in between parentheses. So it should be like
if($usn == $name && $usp === $pass){
echo 'Welcome'.$usn.' your marks are 90 in math blablabla';
}else{
echo 'nope, not this time';
}
0
<form method="post">
name:<input type="text" name="name" id ="name" ></br>
password:<input type="text " name="password" id ="pass ">
<input type="submit" name="submit" value="submit">
<?php
$usn="praveen";//username is praveen
$usp="bsd"; // password is bsd
if(isset($_POST["name"])&&(isset($_POST["password"]))){
$name=$_POST["name"];
$pass=$_POST["password"];
if(($usn==$name)&&($usp==$pass))
{echo "welcome".$usn;
echo "Ur marks are";
echo "maths=90
eng =80";}
else {echo "wrong password ";}
}
?>