Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: help with form

  1. #1
    New to the CF scene
    Join Date
    May 2008
    Location
    west coast of canada
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help with form

    i am working on an order form for a friend and need to know where to enter an array in the php code. here is the php...

    foreach ($_POST as $key => $value) {
    $key = clear_user_input($key);
    $value = clear_user_input($value);
    if ($key=='extras') {

    if (is_array($_POST['magnetic thoughts']) ){
    $body .= "$key: ";
    $counter =1;
    foreach ($_POST['magnetic thoughts'] as $value) {
    //Add comma and space until last element
    if (sizeof($_POST['magnetic thoughts']) == $counter) {
    $body .= "$value\n";
    break;}
    else {
    $body .= "$value, ";
    $counter += 1;
    }
    }
    } else {
    $body .= "$key: $value\n";
    }
    } else {

    $body .= "$key: $value\n";
    }
    }

    I have my html like this.....

    <p class="legend">magnetic thoughts @ 3.95 each</p>
    <fieldset id="choices">
    <p id="magnetic thoughts">
    <input type="checkbox" name="magnetic thoughts[]" value="ma01" />ma01
    <input type="checkbox" name="magnetic thoughts[]" value="ma02" />ma02
    </p>

    </fieldset>

    there are many other items but noone needs to see all of that.

    any help is appreciated.

  • #2
    Regular Coder Iszak's Avatar
    Join Date
    Jun 2007
    Location
    Perth, Western Australia
    Posts
    332
    Thanks
    2
    Thanked 58 Times in 57 Posts
    The space could be a problem with the naming so use a underscore.

  • #3
    New to the CF scene
    Join Date
    May 2008
    Location
    west coast of canada
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok, did that and inserted a new script that works wonderfully when the user completes their order. My problem is that the order that comes to my email just says....after listing name and address and all the other info......magnetic_thoughts: Array. so it doesn't give the individual names of the products that have been ordered.
    any thoughts on how to fix this?


  •  

    Posting Permissions

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