Why can't I find the answer to anywhere?

Hi, please help a beginner...

I am trying to build an online catalog with PHP and MySQL, using Dreamweaver.

I have a problem with filters... here it is:

I have a few variables... take 1 e.g. $manuf in which I want to store the manufacturer (for the table of books, as "acer", "alienware" etc.).

I thought I'll make filters in 2 ways:

1. via the dropdown list/menu and I populated the list with values 'acer' 'alienware' etc.

and in the case of "OnChange" of the list/menu I want to assign the value selected from the list/menu to the $manuf variable.

HOW do I? I can't find something as a list1.selected for example property simply write <? php list1.selected $manuf = ? >

where list1. must match the name of the list/menu (right?...)

or


2 it looks better with a SpryMenu.

So I have a Spry Menu as "manufacturer", etc.

And as the submenus "Acer", "Alienware" etc.

now... when I click on the submenu labeled "Acer" I can just do the php $prod = "acer" BUT HOW I can also change the menu caption to say "Manufacturer - Acer" instead of simply "manufacturer"? (because I want people to see what the filter is applied). Still, I can't find any good like sprymenu1.caption or something like that.

P. S.

regarding the list/menu... I can fill it dynamically from the database with the values in the $manuf field. BUT they repeat, because there is more than 1 'acer' e.g. in the catalog (database). HOW can I dynamically populate the list from the database, without repeating any value?

For now I think I'm going to start with a few 1 problem because I think that I'm going through explaining this to you, the answer to #2 will become clearer.

JavaScript is like Actionscript (Flash) and can be executed in run mode, which means that if you run javascript on a page you can see the results immediately.  PHP, on the other hand, is a preprocessor which means that the code is run before loading a page and cannot be executed in run mode as Javascript can.  The mix of both for this instance is really not necessary unless you want the form to act dynamically.  For this reason, there are 2 ways to deal with the situation:

1. If you want to stick with PHP, when you submit the form, the values of the stored will be stored in the global variables ( http://php.net/manual/en/reserved.variables.php ).  Based on the method of your form will depend on how to extract the data.  For example, if your form method is "POST" and the drop-down list field named 'Fab' has a value of 'Dell', then when you submit the form, the variable $_POST ['manuf.no'] will be equal to "Dell".

With this example, the form must be submitted because the Javascript cannot send commands to PHP once the page has loaded, because the PHP has already been run.

2. this way is a lot more complicated if I will not go into the details.  But, the Spry data set functions are for the update of live data without having to submit a form to force a refresh of the page for the PHP to run.  What happens with the Spry data set, is that you store all the information in mySQL and then Spry data set that will convert to XML for you. PHP will be used to run the original query in your database, and depending on the size of your database can be used to filter the data so that you don't end up with an extremely large XML file, slowing down your page load time.  I have a basic example I have awhile back located here ( http://www.exitplaystation.com/warhawk/trophies.php ).  Who uses a static XML document at the time.  I have a more dynamic example.  It was made for the work, but I might be able to change with false information and upload to show you a dynamic version.  In the meantime, if you want to see a professional example in action:

http://MSN.FOXSports.com/NFL/draft-tracker#round=1&team=all&school=all&position=all

FoxSports use Spry data sorting features and additional code for their live draft NFL system.  Refreshes automatically and sort the menu drop-down above.  So as you can see all of their data is responsible for their connection to the base and updated in real time.  This is a very complex example and requires changes to the Spry code, but it shows the power of what can make Spry.

Let me know how you prefer to go with that.  Personally I would recommend #1 for beginners, until you go and feel more comfortable with PHP and Javascript.  Also if you give more than a little more in detail about your code I could help you implement if you find it difficult to understand.

Tags: Dreamweaver

Similar Questions

Maybe you are looking for

  • bitrate

    Hello world I want to check the flow rate sent out by a random number (from 0 to 1), but may not be able to. in fact what I did uptill now is that I have placed a function of matrix building with two entrances (first of all, as the number of cycles (

  • Updating a laptop that has been months in offline mode

    I have an old laptop that was inactive for months due to a defective power cord. I fixed it and want to get it online.I want to install all the security updates Microsoft up to present while the PC is always online, because I'm afraid that the PC cou

  • HP photosmart C4580 Mac cannot print double side

    Phososmart HP C4580, unable to print double against the mac, there is the button, but it is gray and you can't choose

  • Buy in store or monthly payment?

    I am a student and I have experience using Photoshop.  I have photoshop personally.  I am deciding between the purchase of the software in a store or the payment of the monthly fee.  What are the differences between these two options and what do you

  • The animation loop

    Just started using Edge animate trials on the first tutorial. In the trial of Hippo, I notice a loop is the default, but I can't seem to find an option in a loop on the edge. Is this one?Thank youPaul