search

Home  >  Q&A  >  body text

php - The form is submitted to action. The user input is illegal and a prompt is required. How to deal with it?

<form role="form" action="verify.php" method="post">
      <input type="text" name="test" placeholder="xxx" >
      <button type="submit" class="btn">登 录</button>
</form>

verify.php determines whether the input is illegal. If it is illegal, how can the user be prompted?

ps: If you use jquery to bind the button, you can. But I want to know if the submission method like form/action can output the judgment result to the front desk?

漂亮男人漂亮男人2770 days ago483

reply all(1)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-24 11:36:13

    • If you use jq’s ajax method, you can load the error reminder to the end of the form

    • If you only use PHP, you can only add the error message and re-render the page

    reply
    0
  • Cancelreply