Is there an easy way to handle forms with PHP?

℡╲_俬逩灬. 提交于 2019-12-12 02:45:42

问题


Dealing with forms in PHP has always given me major headaches. Primarily formatting; handling punctuation inside a form input, manipulating strings for database insertions, stripping when retrieving from database, etc.

Is there an easy alternative to strip_slashes and all that junk? I don't want a tool like a form wizard that does everything for you - I still would like a high level of customization. What would be nice though is a tool that says "I want this text field to connect to this database field.", then it handles all that tedious work.


回答1:


Look up PHP PDO. It makes it quite nice to handle all of the database stuff. As for mapping forms. . . You'd need another application (if one exists out of the box) to handle that.




回答2:


You should look into PHP frameworks which are specifically designed to support systems involving user input.

Personally I've used CakePHP and it's been very useful (though it does tend to assume you have a fairly simple data model and you don't mind creating it from scratch). It's highly customisable (you create all form components yourself) and if you use its full capabilities it will handle slashes and database fields and all the rest.

Other frameworks are available...



来源:https://stackoverflow.com/questions/7841213/is-there-an-easy-way-to-handle-forms-with-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!