0

Hi this is the first time I've written php to process form data, I have already implemented the jQuery to validate, and I have written the PHP to process the form, and also encryption, salting escaping and filtering, before I write the code to insert the data into the db, I am just wondering how to send the results of the php validation back to the front end. There is a level of security in the jQuery, however this might be turned off, but the level of security through the php is greater, especially regarding email validation. The PHP is in a seperate file, so I'm wondering the best way to connect the PHP programs back to the front end to inform the user as to whether their data is acceptable. I've heard of session redirects, and also Ajax but would not want to use this in case JS is turned off.

Thanks Ant

4

1 に答える 1

1

これには AJAX を使用します。これにより、データを PHP スクリプトに送信し、ユーザーを現在のページにとどめることができます。次に、すべてが PHP の検証に合格したかどうかに応じて、trueまたはのようなものを返すことができます。false

ユーザーが Javascript を無効にしている場合、ファンシーな Web サイトで楽しく興味深いことを行うことはできません。ユーザーが JavaScript を有効にしていない場合の処理​​方法については、こちらをご覧ください。

基本的に、通常のフォームを作成し、ユーザーがページを送信/リロードして、完了したことを知らせたり、エラーを修正したりするために必要なエラー/成功メッセージを表示する必要があります。

于 2012-10-02T22:20:40.443 に答える