Printing a PHP error inline instead of erasing the entire page

前端 未结 2 1509
感情败类
感情败类 2021-01-17 01:07

How can I make PHP print an error inline instead of changing the entire page?

I\'d like it to target #errors and fill that instead of changing everythi

2条回答
  •  攒了一身酷
    2021-01-17 01:21

    Put the error in a variable where you do your logic and print its contents in #errors. For example:

    if (username_is_incorrect()) $error = 'Incorrect username or password.';
    

    And in the HTML

提交回复
热议问题