how to stop a form submitting when you press enter php

how to stop a form submitting when you press enter php

how to stop a form submitting when you press enter php

You've created a lovely form but whenever someone presses enter your form submits when you don't want it to you just want it to move to the next field or even stay on that field.

I searched for an answer to this on line but didn't come up with one. All php checks ie isset form submit or submit =1 etc etc all never worked until i added another submit button.

Then it became simple case of if ($_POST['submit']=='SUBMIT') {

Your code goes here

}

If you only want one button then you need to hide the other button. Alas using visibility doesn't work as this ignores that there is another button there and creates the same problem.

So i created a button that had the same background and border color as my page background. and width=1 this will make a small button that won't be seen and solves the problem of hitting the enter button.

HOW TO GET MORE CUSTOMERS

How to stop paying council tax 

I'm having a clear out, new things added daily

How to stop paying council tax

Stunning cushion 40cm x 40cm...

Stunning cushion 40cm x 40cm Constellations of thoughts


£24.00

Matt Handcock Pin cushion...

Matt Handcock Pin cushion


£3.99

Wine bottle gift bag/ holder...

Wine bottle gift bag/ holder linen new hand made


£3.00

Bean Bag door stop - new ...

Bean Bag door stop - new


£4.00

New Glasses Holder...

New Glasses Holder


£4.00

New Glasses Holder...

New Glasses Holder


£4.00

Stunning cushion 40cm x 40cm...

Stunning cushion 40cm x 40cm Constellations of thoughts


£24.00

Cleaner in Woking