Run time login form using php with html

[size=12pt]This is my login form in HTML[/size]

[code]

Student Registration System [/code]

[size=12pt]THIS IS MY PHP CODE [/size]

[php]<?php
$a=$_POST[‘User Name’];
$b=$_POST[‘Password’];
if($a == $b)
{
echo ‘Welcome’;
}
else
{
echo ‘Please Try Again’;
}
?>

[/php]

SUPPOSE I WILL GIVE SAME USER NAME AND PASSWORD,THE OUTPUT IS please try again…
Please help me…

could be the fact you have a space in the name. Take out the space.

Your PHP code is comparing a user name to a password. In most every case they will not be the same. Traditionally usernames and passwords are stored in a mysql database and you must query the database to see is the user name and password match a record in the database.

You need to completely start over with your PHP code as what you have now is nonsense.

What he’s done now isn’t nonsense. It should do what he has it programmed to do, it just needs the space removed. Please treat other users as you expect to be treated.

Ok RathXC, below your name you have:
PHP Programmer & Web-Designer
Expert PHP Helper
Senior Member

Frankly, if you’re an ‘Expert PHP Helper’ can you tell me what this code line does?

[php]if($a == $b)[/php]

he’s comparing the user name to a password. The way his code is now anyone typing the same thing for user name and password will get a ‘Welcome’. This is no validation as a login script would need. As I said before, his PHP code is rubbish and frankly if you haven’t caught the big error, you shouldn’t have ‘PHP Programmer & Web-Designer & Expert PHP Helper’ under your name either!

Learn to read exactly what the original poster put. he MEANT to give them the same.

I earned the “Expert PHP Helper” title here for a reason. No point trying to undermine me with it.
The PHP Programmer & Web-Designer are my custom titles that I put there. The Expert PHP Helper is my user group.

I also don’t appreciate the disrespect you are showing me with that reply.

I still stand by my statement that his PHP code is complete nonsense. It is not in any stretch of an imagination, what he should be doing in a proper login script (which is in his subject line). I would gladly offer the gentleman some assistance in building a proper validation script, but it seems he has abandoned this thread, leaving only us to split hairs.

Between a syntax error and a methodology error the later is more sever. Syntax errors are easily correctable, methodology errors require attaching the problem from a new approach, which in most cases requires a complete rewrite of applicable code.

I’ve written plenty of nonsense code in my day, so I ought to be able to spot it too. I would have loved to have had someone to tell me my code was nonsense, before I spend aggravating hours, days, weeks, only to find on my own my code was nonsense. I don’t make any claims as to coding ability, I just get the job done.

judging by the fact he stated it in the first place that he wanted them the same, he most likely was going to change it he just wanted to know why it wasn’t going through properly as it was.

Also, locking this topic since the guys vanished.

Sponsor our Newsletter | Privacy Policy | Terms of Service