2 Replies - 2402 Views - Last Post: 04 May 2011 - 09:16 AMRate Topic:

Refactoring PHP login script to use with html form

Posted 03 May 2011 - 10:39 AM

Hi everybody,

I have this php login script which I would like to use with an HTML login page my group mate created.

Now I know from previous post that login should be best handled with just a php script alone, however for the sake of keeping things civil and easy
for group-mate, I would like to know how can I use this php login form with the html form method = "post" action = "".

I am thinking that I should just remove the print '<form action="login.php".....> section of my code but, will that work and is there a better way (other than obviously just using the PHP form alone) to do this.?

I am enclosing my php form first and then my classmates html form second.

Re: Refactoring PHP login script to use with html form

Posted 04 May 2011 - 09:16 AM

Thank you for your input codeprada,let me start off by explaining about the apparent duplicate post, I had a new question and thought it was appropriate to place that in a new post whereas it would be off-topic for my old post. If that was incorrect of me I apologize.

Quote

Why is line 17 and 18 after 15 and 16? You can't talk to someone on a phone before the phone company connects you . It's the same with databases.

I wasn't aware of that, I thought that like Java variables need to be defined at the top of the code.

Quote

You have ob_end_clean() without a ob_start().

I don't know how the "ob" function works, I just copied the rest of the code from my professors example as is.

Thank you for all the code recommendations, I will try to implement them.