Results 1 to 2 of 2

Thread: [RESOLVED] for each array problem

  1. #1
    Join Date
    Mar 2008

    resolved [RESOLVED] for each array problem

    Hey peeps,

    I have a form which has checkboxes and textboxes.

    Im trying to make a for each to duplicate all the data appart from one cell and make a new insert for every checkbox that has been checked:

    for each checkbox that has been checked insert into the database. so it'll look something like this

    col1 col2 col3
    1 2 3
    1 2 5
    1 2 9

    Here how far its come:

    PHP Code:

    echo '<p> post places: ' $_POST['place'] . '</p>';
    $places_array explode (',' $places);
    '<p> places array: ' print_r($places_array) . '</p>';
    $places_array as $place_entry){
    $insert "INSERT INTO activities (`date`, `email`, `place`) VALUES ('".$daf."','".$email."','".$place_entry."','")";
    $add_activity = mysql_query($insert);
    $add_activity == false) {
    $error = mysql_error();

    This is what it prints out

    post places: elm, fir

    Array ( [0] => elm [1] => fir )
    places array: 1

    elm0 fir0

    How would you make this work?

  2. #2
    Join Date
    Mar 2008
    I made it insert into the database the way i want BUT it leaves all the other fields blank HELP


Thread Information

Users Browsing this Thread

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

Posting Permissions

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