from ASP.NET to PHP

Hi,

I am moving from ASP.NET to PHP… In ASP.NET there are two files, design file and code file. In PHP there is only one file…

so what’s the best practice…?

for example, if I have a personal information file to display personal information from database and post to database once user click on save…

What’s the best way to do this? all in one file? I mean the data retrieval and the data save (form action)?

Well the reason that .NET works the way it does is because it’s a framework. There are plenty of PHP frameworks. I like CakePHP but there are others and several newer ones. Most if not all of these separate business logic and presentation files. I’ve never used it, but PRADO was supposedly modeled after .NET.

Have a look at MVC & OO PHP.

I’m pretty sure MVC can be used as the same principle in PHP or ASP. That would be 3 sections though, Model, View, Controller.

if you’re talking about editing user info in the browser - say like in a back-end system -
then either way is fine.

Single page:
You would check if the form had been submitted at the top of your code and if so process it.

Two page:
Show the form
Process the form.

Using MVC principals, the second option is better - keep the logic, view, controller separated as much as possible.

Red :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service