criostage Posted December 14, 2011 Share Posted December 14, 2011 Hi, I m doing some work for my self an because of that i been reading a lot arround about PHP, and theres something that i would like to ask a bit of enlightenment. So my question is as the title says about html form's using php to insert data into mysql, i been reading tutorials arround the interwebs and even made afew successful tests, but pretty much all tutorials use 2 files to accomplish this the html file with the form and an insert.php where the actual code is stored so this made me think is this how usually it's done? in over all you will have 1 file for the form, 1 for the insert, 1 for the edit php code and 1 for delete. How do you guys usually do it? PS: one of the tests i did was making 1 single file with all these using an switch. My interest in making this question is solo to learn how other people do it to see if i m in the right way. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/253165-simple-question-about-html-forms-php-and-mysql-inserts/ Share on other sites More sharing options...
litebearer Posted December 14, 2011 Share Posted December 14, 2011 My personal preference is to use separate pages. Form page; Process page; etc. For me it makes it easier to track my errors (of which I have had many) Quote Link to comment https://forums.phpfreaks.com/topic/253165-simple-question-about-html-forms-php-and-mysql-inserts/#findComment-1297883 Share on other sites More sharing options...
xyph Posted December 14, 2011 Share Posted December 14, 2011 http://en.wikipedia.org/wiki/Post/Redirect/Get Is my personal favorite method. There's lots on the web about it. Quote Link to comment https://forums.phpfreaks.com/topic/253165-simple-question-about-html-forms-php-and-mysql-inserts/#findComment-1297891 Share on other sites More sharing options...
criostage Posted December 14, 2011 Author Share Posted December 14, 2011 Thank you both for your opinions, i appreciate it Quote Link to comment https://forums.phpfreaks.com/topic/253165-simple-question-about-html-forms-php-and-mysql-inserts/#findComment-1297957 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.