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.

 


CAN YOU HELP


Turbo Charge your business

We put our money where our mouth is. Our mission is to help any business anywhere get back on track.

If we don't bring you new customers you pay us nothing. We take nothing up front and there is no contract. We trust you implicitly. And it is literally if you don't pay us for bringing in new customers, then we stop brining them in.

You decide how much you are willing to pay for a customer and you pay once we bring them to you.

Simple, easy nothing else to explain.

If you would like us to help you get your business or products booming email us at zigzads@gmail.com

Speak soon.