adding list items to a database

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default adding list items to a database

    Not sure if this is javascript or php so i put it in both newsgroups, sorry
    if it's the wrong group.

    I wrote (with help) a code to put several items in a list object (select)
    and I would like to add the items in this list to a database.

    I know how to add a selected item to the database but how can i put al the
    items tot the database. I need somekind of loop wich go's through the list.

    Any suggestions


    roy


    R.G. Vervoort Guest

  2. Similar Questions and Discussions

    1. How to delete items NOT in a list
      I have a table with current movie titles identified by ID number and another table with reviews of those items, also containing the ID number. The...
    2. JavaScript: html list items within list items?
      Hi, I've seen how to implement a JavaScript to change the CSS class of every other list item in an unordered list, but, being new to JavaScript,...
    3. Adding items to a cfgrid
      Hi! I'm trying to add items to a cfgrid using form elements. E.g. I have fname textfield, lname textfield, market comboBox, etc in my form I want...
    4. adding items to a list or menu
      Not sure if it is a php question but since i am working in php here it is. Ho can i add items to (the item label=visual text and the value=index...
    5. Adding Attributes to RadioButtonList Items?
      I am trying to use a RadioButtonList bound to a custom datasource to acomplish some user functionality. I want to add various...
  3. #2

    Default Re: adding list items to a database

    R.G. Vervoort wrote:
    > Not sure if this is javascript or php so i put it in both newsgroups, sorry
    > if it's the wrong group.
    >
    > I wrote (with help) a code to put several items in a list object (select)
    > and I would like to add the items in this list to a database.
    >
    > I know how to add a selected item to the database but how can i put al the
    > items tot the database. I need somekind of loop wich go's through the list.
    >
    > Any suggestions
    >
    >
    > roy
    >
    >
    Its a PHP issue... javascript will only make changes to the client (web
    browser) whereas PHP is server based.

    Your form has its contents written to $_POST so you can loop through its
    contents with

    <?
    foreach($_POST as $key=>$value)
    { print("<br>$key = $value"); }
    ?>

    You should ensure your data is clean before writing to the database - if
    you don't you risk someone putting data in to the form that could give
    them access to removing one or more files from your system by simply
    having data input using hooks (`) or backslashes.

    Download and view the php guide from php.net - I use it all the time and
    its pretty good both as a function reference and it has some examples.

    I suggest you buy a good book (I have Core PHP by Leon Atkinson for PHP
    4 and more recently version 5 and its excellent) and also keep a close
    eye on comp.lang.php as there is good help there.

    regards
    randelld
    Reply Via Newsgroup Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139