SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member mkorsmo's Avatar
    Join Date
    Jan 2005
    Location
    St. Paul
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP/MySQL + Complex form design question...

    Hei hei!

    I'm building an event calendar for a coffee shop that has a small stage. One part of this PHP/MySQL application is a form that allows the owner to input event information (to be displayed on a calendar). Having a stage, their events often involve musical acts... I am looking for a suggestion for how to handle the ability to add multiple bands to an event. I intend to use a lookup table as the band information is entered into the database already. I understand how to the database side of it, I'm looking more for suggests about the actual form mechanism... One thought I had was the combination of a pull down + "add" button putting bands into a multiselect box? (Though I've never been able to figure out how to send the contents of a multiselect box to a database (without actually selecting all the entries...) Anyhow, I hope I have explained the issue well enough to elicit some suggestions.

    I'd prefer to be able to accomplish this on one page, it seems like such a thing should be possible... but I lack the depth of experience.

    Any suggestions would be helpful.

    Regards,

    Matt

  2. #2
    SitePoint Guru gavwvin's Avatar
    Join Date
    Nov 2004
    Location
    Cornwall, UK
    Posts
    686
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Some options:
    -have a select box with all the unassigned bands, then press "add"
    -have a list of all the unassigned bands with checkboxes next to them, which the owner can select/unselect (if theres not very many bands)
    -select multiple

    for a select multiple box you call its name something like "bands[]"... the [] indicates to php that it should be an array, and all the selected values are stored in the array:
    <select name="bands[]" multiple>
    <option value="1">Band A</option>
    <option value="2">Band B</option>
    <option value="3">Band C</option>
    </select>
    say that bands a and c are selected and the form submitted via post, the values would be:
    $_POST['bands'][0] = 1
    $_POST['bands'][1] = 3

  3. #3
    SitePoint Member mkorsmo's Avatar
    Join Date
    Jan 2005
    Location
    St. Paul
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thank you

    Thanks for your response gavwvin,

    I think I will use a multiselect box as you have described.

    Matt.


Bookmarks

Posting Permissions

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