Validate Form with PHP AND JavaScript?

前端 未结 4 2091
夕颜
夕颜 2021-01-07 05:13

Is it possible to validate a form with PHP and JavaScript? I\'m currently able to do both using my existing form, but only on

4条回答
  •  死守一世寂寞
    2021-01-07 05:15

    I've not tried this, but off the top of my head; you don't need the language="JavaScript" in your form for it to use the onsumbit event handler. If that event evaluates to true, then the form will be submitted as normal (so PHP will see it and can do its validation).

    It's good to see you're not relying on client-side validation. It's trivial to disable JavaScript in a browser. One should always validate one's input.

提交回复
热议问题