When coding PHP together with HTML, it always seems confusing and very painful to look at. The structure is not easy to understand.
Can anyone tell about how to code PHP with HTML in good structure?

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are methodologies out there that help with this issue, such as Model-View-Controller (MVC). MVC seperates your data layer, from your logic, from your presentation (UI) layers. A framework such as CodeIgniter would help you in this case. Even if you weren’t going to use an existing framework, seperating out your data models from your business logic and then from your UI objects is relatively easy.
Edit: Let’s say you have a shopping cart page. You can have a “view” file called cart.php, and then you can send it information from your other PHP files (the “Controllers”), so that instead of this:
you can do this:
In this scenario, all logic and data access are handled before you attempt to display the page.