1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

help with multi option check box and sending email thru form

Discussion in 'PHP' started by saturn100, Apr 28, 2012.

  1. #1
    I have an email form that works great
    But I am having problems adding a multi check box area to it

    I added in the HTML no prob but it aint sending the details right
    in the email I receive it only shows one of the options

    <form>
    <input type="checkbox" name="vehicle" value="Bike" /> I have a bike<br />
    <input type="checkbox" name="vehicle" value="Car" /> I have a car 
    </form>
    HTML:
    I then did a bit of googling and was advisted to put [] in after the name

    <form>
    <input type="checkbox" name="vehicle[]" value="Bike" /> I have a bike<br />
    <input type="checkbox" name="vehicle[]" value="Car" /> I have a car 
    </form>
    HTML:
    I did but now in the email it sends it just gives a result of "Array"

    In the PHP it is a request tag

    $vehicle = $_REQUEST['vehicle'] ;
    PHP:
    any ideas
     
    saturn100, Apr 28, 2012 IP
  2. heloraghu

    heloraghu Member

    Messages:
    133
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    46
    #2
    by using multi option check box you can face several problms to sending the mail better to search for alternate
     
    heloraghu, Apr 29, 2012 IP
  3. trixy

    trixy Active Member

    Messages:
    177
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    53
    #3
    yes, try to make
    <option>option 1 </option>
    <option>option 2 </option>
    <option>option 3 </option>

    and more
     
    trixy, Apr 29, 2012 IP
  4. Technary

    Technary Member

    Messages:
    429
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    33
    #4
    And the options here are the names of the vehicles you wanted to display.
     
    Technary, Apr 29, 2012 IP
  5. downloadphpscripts

    downloadphpscripts Peon

    Messages:
    21
    Likes Received:
    1
    Best Answers:
    3
    Trophy Points:
    0
    #5
    Hi there. It's an array so the $_REQUEST is now a multi-dimensional array with it's own keys. The following bit of code should print out all selected options:

    
    $vehicle = $_REQUEST['vehicle'] ;
    foreach($vehicle as $vehicle_key => $vehicle_value)
    {
    $vehicle_content .= $vehicle_value . "\r\n";
    }
    
    PHP:
    Also, you'll want to make sure the form action is post.

    Hope that helps!
     
    downloadphpscripts, Apr 30, 2012 IP