dynamic HTML forms *PHP Help*

Discussion in 'OT Technology' started by Mikey, May 25, 2004.

  1. Mikey

    Mikey This one, this form I hold now, so Wide eyed and h

    Joined:
    Oct 18, 2001
    Messages:
    23,118
    Likes Received:
    0
    Location:
    Baltimore
    I'm working on a clients eCommerce website. He is selling vinyl graphics. He has over 246 libraries of images he wants to sell. Each library has about 50 images he can make and sell. Here is the file structure that im working with...

    www.hisdomain.com/images/library001/001.gif
    www.hisdomain.com/images/library001/002.gif
    www.hisdomain.com/images/library001/003.gif

    www.hisdomain.com/images/library002/001.gif
    www.hisdomain.com/images/library002/002.gif
    www.hisdomain.com/images/library002/003.gif

    What I need to do is when some clicks on a link to "library001" I need to display a html page with "add to cart" form options for each of the image in that library and also display the image with the form. I'm hoping there is an easy way to dynamically do this, so I don't have to create a form for each of the 12,000 items.
     
  2. Slid.

    Slid. I'm a guy.

    Joined:
    Oct 25, 2001
    Messages:
    1,928
    Likes Received:
    0
    Location:
    NH
    There is - you'd need a PHP script that would handle the process after someone clicks on 'library001'. You'd make a call like library_contents.php?library=library001 - the php script would use the library to find the proper directory then it would get a list of all the files in the directory (20-50, what have you) then it could dynamically create your page for you.

    If you do a search you can find a script that gets all the files from a directory - they are usually pretty small but you'll have to make some changes to it.

    Once you know all the filenames it should be cake - just loop from 0 to the number of files and make your page.

    gg.
     
  3. Mikey

    Mikey This one, this form I hold now, so Wide eyed and h

    Joined:
    Oct 18, 2001
    Messages:
    23,118
    Likes Received:
    0
    Location:
    Baltimore
    thank you
     
  4. Mikey

    Mikey This one, this form I hold now, so Wide eyed and h

    Joined:
    Oct 18, 2001
    Messages:
    23,118
    Likes Received:
    0
    Location:
    Baltimore
    now im getting all of the filenames but i just gotta loop through to generate the form for each
     
  5. Slid.

    Slid. I'm a guy.

    Joined:
    Oct 25, 2001
    Messages:
    1,928
    Likes Received:
    0
    Location:
    NH
    Right, whatever function you use will probably spit out an array of the file names for you - then you just start a new loop and generate your page.
     

Share This Page