Jump to content

tomschwanland

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by tomschwanland

  1. Hi, Essentially I know the theory for working in PHP, SQL, HTML, Sessions, etc. However, what I am missing is connecting the dots most efficiently. I am trying to build a very simple online car configurator. The flow is: user picks a brand depending on the previous choice, user is presented with models, user picks one depending on the previous choice, user is presented with model lines, user picks one depending on the previous choice, user is presented with engines, user picks one depending on the previous choice, user is presented with options, user picks 0-n options user can submit a form that generates an email with all of the previously chosen options. My current "design" works. But it is very nasty to maintain and I am sure there are better ways of going about it. I have a single, monolithic PHP file where everything happens. I don't use any classes or functions. I don't use AJAX. Data and GUI layer is all mixed up in the same file I have one SQL data base with several tables. One for the models, one for the brands, etc. Roughly the steps are as follows: Start session, check the phase the user is in by looking at what has been set already in the session E.g. if user has already selected a brand, models must be shown etc. SQL statement depending on phase, is executed to show all relevant items for that phase within the same PHP file. When a user clicks on any item, they simply call the same PHP page via GET (e.g. ?BrandID=2). That value is then stored into the same session. got to 1. for the other items. My session variables are very simple and unstructured: $_SESSION['BrandID'], $_SESSION['ModelID'], etc.I know this is a weird and sort of generic question. But I would love to know what the best practices are of how to structure this whole thing. How would you structure it? should I use classes for the sessions, SQL queries, etc.? Is there a better way than to use GET? Should I have the SQL queries and or session logic defined in a separate file/function/class? Separating GUI from data layer? How can this be achieved? Input is greatly appreciated. Cheers! Best regards, Hans
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.