SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Insert form arrays

    I have users doing Inserts from checkboxes, and have questions about the basic layout of the form.

    a) Will this Insert in the column as an array, csv?:

    <input type=checkbox name="form.col[]" value="1"> first >
    <input type=checkbox name="form.col[]" value="2"> second >
    <input type=checkbox name="form.col[]" value="3"> third >

    b) how do I gather these for an Insert ( OnCLick=checkALL ?)

    c) my forms will have a section like this, but others will have added sections on them, for checkbox values within other categories. How do you organize the OnCLick=checkALL for something like this?

    e)Later, can a SELECT statement be done on these stored values in the col with "="?

    Anyone know a decent tutorial on php checkbox forms for Insert? (Update too? -- will Update be workable if number values are stored in an array?)

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    for(reset($i); $i <= $_POST["form.col"]; ++$i) {
    $hey $_POST["form.col"][$i];

    cheers
    Last edited by reminder; Nov 28, 2004 at 03:38.

  3. #3
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    reminder,

    -excuse me but what does this do?

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    this grab the value from all checkboxes..
    and if u want to check all checkboxes by clicking on a checkbox use this...
    Code:
    function checkAll() {
    var hey = document.myForm.myCheckboxes;
    for(i = 0; i < hey.length; i++) hey[i].checked = true;
    }
    cheers
    Last edited by reminder; Nov 28, 2004 at 05:35.

  5. #5
    SitePoint Wizard
    Join Date
    May 2002
    Posts
    1,370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    reminder,

    I'm kind of lost on all this, I know you're trying to help & I appreciate it. Do you know of a good tutorial that could walk me through doing more complex forms?

    Still debating on whether I should try to Insert values into single column arrays because I really don't know how easy the values will be to work with;

    -ex: SELECT and Like% //on the column when joined with other tables.

    -Whether combined inserted values will be automatically seperated by spaces or commas, etc. I've only done basic Inserts and have been advised not to use Arrays in col's, since extracting/ recognizing values could be difficult.

    For my forms, there are many disorderly values to place dynamically in sections on my differnet forms (which is what I wanted to Insert numeric array values into a single column). If I do many to many's (which I don't want to, these are single page forms) I'll have tens of thousands of rows on the Many to Many table before I can turn around. I'd rather store 12 values in a row rather than have 12 rows on a table.


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
  •