0

Im not able to didplay the output data which i got through a form ...(form being submitted to itself)...help me out

22nd Dec 2016, 5:42 PM
Praveen Bsd
Praveen Bsd - avatar
4 Answers
+ 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
22nd Dec 2016, 5:50 PM
CHMD
CHMD - avatar
+ 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? đŸ€”
22nd Dec 2016, 5:46 PM
Daniel Sattler
Daniel Sattler - avatar
+ 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'; }
23rd Dec 2016, 3:38 AM
CHMD
CHMD - avatar
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 ";} } ?>
22nd Dec 2016, 6:07 PM
Praveen Bsd
Praveen Bsd - avatar