Jump to content

Having the same 2 forms on the one page


cliftonbazaar

Recommended Posts

I have a log in area at the top (and bottom) of my home page - and neither of them work, but if I delete either of them then the other works.

 

My code is

<FORM ACTION="check_login.php" METHOD="post">
  <P ALIGN="center"><b>User name :</b> <INPUT TYPE="Text" NAME="UserName" SIZE="25"><b>Password :</b> <INPUT TYPE="Password" NAME="Password" SIZE="25">
<INPUT TYPE="Submit" VALUE="Login"></FORM>

Note that the code at the top and bottom were cut and pasted so they are EXACTLY the same.

 

I tried to delete "</FORM>" from the top one and "<FORM ACTION="check_login.php" METHOD="post">" from the bottom one but they still don't work.

 

Is there a way to get these both working?

Link to comment
https://forums.phpfreaks.com/topic/219853-having-the-same-2-forms-on-the-one-page/
Share on other sites

Exactly how do they not work? What is in check_login.php?

 

Sorry, should have explained this better.

 

In check_login.php if username or password aren't valid then you goto an error page.

If you put the correct username and password into the main page while the code (that I put in my original post) is on the page TWICE then you end up at the error page; if the code is on the page ONCE then everything is successful.

 

Hope this explains it better.

Your form should always have a name.  I've created a page (for giggles) on my local server that all it does is log people in, it has 13 login forms and all 13 work....

 

Try adding a name like frmLoginTop and frmLoginBottom and see what happens then... your submit button should also have a name...  ie:  <input type="submit" name="button" id="button" value="Submit">.  I have sometimes run into weird issues when i try to use caps for everything in HTML like mysql SELECT * FROM blah WHERE d = BLEH or the like.

 

So turn down the caps and see where that takes you from there.

 

also code on the html other than a single form would be helpful.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.