Php with Form Menus and MySQL [Solved]

I might be getting complex here I don’t know.

I’m very very very new at PHP. Just finished the Tutorials PHP and MySQL.

I’m trying to develope a form thats dynamic and changes. The form will be used for customizing a custom computer system.

Just for a small example: I will talk about the 3 top menus in the form,
Processor - Motherboard - Memory

The first form menu is processor. If a customer or user pulls down the menu and chooses a Pentium 4 3.2 ghz … I need the menu options in the Motherboard menu (in the same form) to change (remove) some of the options because they are not compatible with the processor that was chosen.

I this process will continue with every option… The stuff does not even need to be removed it could just be grayed out and cant be selected, whatever works best.

I don’t know EVEN where to start this… Could I set a Parts Set in the database and work around it… I don’t know.

If anyone goes to … and looks at how they have it. They have it so when someone is configuring their options it does what I’m talking about.

Also second question: Where can I do tutorials and practice php skills and develop them more so I can start promoting myself and take on some paying clients soon.

There are a couple ways to approach this. Depending on how seamless you want this to look you may want to look into AJAX. However, if you just want to get something work now, you can use the onChange function in Javascript.

This would resubmit the form and allow for a new set of criteria to be used to create any and all other select boxes.

sry wrote this yesterday, but i have forgotten to hit submit:

this can be done in two ways:

  1. AJAX. google will give u lots of results.
  2. much easyer. use a submit on change (easy java-script, u may have a look at the PHPMyAdmin-navigation). or multible pages onr where u just couse the processor, and the next to chouse the motherbord a.s.o.

i woud start using the second way and maybe chang it, as soon as that is working to use AJAX.

anyway u need a good db-structure first. u gonna need a compatibilaty table storing what is compatible with what, thats a lot of data, but that table only need to hold 2 id’s (e.g. Processor and motherboard). If u have a form inserting new Components u may use checkboxes to make that, e.g. on the insert-processor form there could be checkboxes with all motherboards.

but u should realy draw that structur on a pice of paper, befor starting to work on the computer.

later u need MySQL-selects using multible tables (e.g. motherbords and the motherbord-proccessor-compatibilaty table, and only select those that have the already chosen prossesor in the compatibilaty-table)

maybe u wanna post ur db-stucture here again.

about learning PHP, this is how i did it:

  • read the PHP-manual. don’t take it just as reference but realy read it. u gonna find out that there is a function for everything, and u need to know that they are existing. if u are programming-minded u will have real fun reading it, and tsting what u can’t do with all that functions. runing and changing the exanples that are provided there. (i know that thaks some time, but in the end there will be nothing u would know how to sole with php)
  • play around with PHPMyAdmin. and always look at the box that is showing the SQL-statment PHPMyAdmin just used to get the things done u made by clicking/filling out the forms.
  • read-about and make use of database-normalization.
  • read how with php normalize html

this may not be the right way for eveybody. but it made me a php-expert.

good luck learning PHP

What exactly is ajax … I thought php was the all mighty and powerful. I have to learn another language or something is make that stuff work?

AJAX is asincronos JavaScript and XML

u alreadey needed an other language: HTML

PHP is just server side. it may respond on any server request, but the client needs an other language (most times HTML, but in this case JavaScript).

thats why we suggested to use a submit. then PHP is able to handle it.

btw: AJAX can be done (and mostly is done) with PHP (severside), but the client side is JavaScript (outputted by PHP as well).


Sponsor our Newsletter | Privacy Policy | Terms of Service