Results 1 to 3 of 3

Thread: PHP drop down menu

  1. #1
    Member
    Join Date
    Jul 2005
    Posts
    172
    Thanks
    9
    Thanked
    5 times in 5 posts

    PHP drop down menu

    Hi all,

    I'm aiming to use PHP to create a 3 step drop down menu that visitors can use to select/tailor a product. Upon selecting the final step, the price needs to be calculated and displayed.

    The first step has 3 options, the second 5 and the final 10, which equates to 150 possible combinations. Would this merit using a MySQL db or could the variables be listed within the code?



    I've briefly skimmed the php manual and I'll paste the code I've been given to work with later, but any tips or pointers as to how to go about this would be appreciated.
    Last edited by =TcQi=; 11-12-2009 at 12:37 AM. Reason: edit

  2. #2
    Pseudo-Mad Scientist Whiternoise's Avatar
    Join Date
    Apr 2006
    Location
    Surrey
    Posts
    4,274
    Thanks
    166
    Thanked
    386 times in 233 posts
    • Whiternoise's system
      • Motherboard:
      • DFI LANPARTY JR P45-T2RS
      • CPU:
      • Q6600
      • Memory:
      • 8GB DDR2
      • Storage:
      • 5.6TB Total
      • Graphics card(s):
      • HD4780
      • PSU:
      • 425W Modu82+ Enermax
      • Case:
      • Silverstone TJ08b
      • Operating System:
      • Win7 64
      • Monitor(s):
      • Dell 23" IPS
      • Internet:
      • 1Gbps Fibre Line

    Re: PHP drop down menu

    Depends if you want to update things. I would be tempted to say go for the mysql database if they're going to be things that change depending on the user/page - say custom options for a product in an estore.

    If it's something like Male/Female, Country, etc then just hard code it.

    If you go the PHP route, store the data in an array with an order that you want things to be listed and an ID that is unique to the page or situation. Then you just search the array with say, "SELECT * FROM list WHERE ID = $pageid" and put that into another array which you can loop through to display the html code. If you wanted you could sort the array you get out of the database alphabetically, etc.
    Last edited by Whiternoise; 07-12-2009 at 09:19 PM.

  3. #3
    Member
    Join Date
    Jul 2005
    Posts
    172
    Thanks
    9
    Thanked
    5 times in 5 posts

    Re: PHP drop down menu

    Thanks for the reply Whiternoise. I took the php route as I was supplied with a previous example to work from. Supposedly the pricing is fairly static, and as I don't have access to the full price matrix, I decided to avoid the extra cost of adding MySQL to the hosting.

    For future reference, wold you recommend using an "associative array" for the sql?
    Last edited by =TcQi=; 09-12-2009 at 12:20 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PHP Windows vs PHP Linux
    By Raz316 in forum Software
    Replies: 5
    Last Post: 15-12-2008, 02:16 PM
  2. Replies: 4
    Last Post: 22-10-2007, 04:54 PM
  3. MySQL extension for PHP 5.2.3 not working
    By Jerrythafast in forum Help! Quick Relief From Tech Headaches
    Replies: 18
    Last Post: 13-06-2007, 08:03 PM
  4. How do I restore "Show Desktop" icon in the Quick Launch bar of Windows?
    By davidstone28 in forum Help! Quick Relief From Tech Headaches
    Replies: 7
    Last Post: 09-01-2006, 01:02 PM
  5. Quick Link Menu + New Egg Banner
    By Lead_Head in forum HEXUS Suggestions
    Replies: 5
    Last Post: 17-05-2004, 07:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •