Mail values from a List with Multiple Selections with PHP

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Mail values from a List with Multiple Selections with PHP

    Hi,

    I have a little problem, I have a HTML-mailform with a List/Menu
    (named informatie) witch allows Multiple Selections (Hold CTRL-key and
    click mouse-button).
    When I test it and select some from the list only the last selection
    is shown in the e-mail and not all of the selections.

    The form is Posted to a PHP mailscript, listed here below.
    I think I has to do this as a array (foreach) but I can't figure it
    out...

    <?php

    @extract($_POST);
    $email = stripslashes ($email);
    $naam = stripslashes($naam);
    $adres = stripslashes($adres);
    $postcode = stripslashes($postcode);
    $woonplaats = stripslashes($woonplaats);
    $info = stripslashes($info);
    $prijsindicat = stripslashes($prijsindicat);
    $telnr = stripslashes($telnr);
    $informatie = stripslashes($informatie); // This is the MultiSelection
    $opmerkingen = stripslashes($opmerkingen);

    $body = "$naam heeft zojuist het formulier van de website
    ingevuld.\n";
    $body .= "\nAdres: $adres";
    $body .= "\nPostcode: $postcode";
    $body .= "\nWoonplaats: $woonplaats";
    $body .= "\nInformatie sturen?: $info";
    $body .= "\nPrijsindicatie sturen?: $prijsindicat";
    $body .= "\nTelefoonnummer: $telnr\n";
    $body .= "Informatie over: $informatie"; // This is the MultiSelection
    $body .= "\nOpmerkingen: $opmerkingen";
    mail('my@email.com',$subject,$body,"From: $naam <$email>");
    header("location:email.htm");
    ?>

    Who can give me some help on this one?

    Thanks.....

    Freebeeezz.....
    Freebeeezz Guest

  2. Similar Questions and Discussions

    1. Making a page values of list and send mail
      Hello Dreamweaver, I need to make quite a simple web page. It has a list of 10 items with radio buttons. The user selects some of the items by...
    2. Pre Fill list menu with multiple selections
      Anybody tell me why this code is not working? I've tried it like every which way I can possibly think of but I can't get the values to show up as...
    3. submit multiple values from a list box PHP
      Can any one tell me how to submit multiple values from a list box? I believe it has something to do with Arrays or Loops but i'm not sure. this is...
    4. Multiple Values in a list box
      Hi everybody. If anyone can tell me how can I choose multiple values in a list box (by using ctrl or shift buttons) and store them in a table....
    5. Selecting Multiple Values in a List/Combo Box
      The following should work: On your close button add the following line before the close command getWellList docmd.close
  3. #2

    Default Re: Mail values from a List with Multiple Selections with PHP

    Nobody ???? :-(


    [email]freebeeezz@hotmail.com[/email] (Freebeeezz) wrote in message news:<1313a966.0504112323.4b96e5ea@posting.google. com>...
    > Hi,
    >
    > I have a little problem, I have a HTML-mailform with a List/Menu
    > (named informatie) witch allows Multiple Selections (Hold CTRL-key and
    > click mouse-button).
    > When I test it and select some from the list only the last selection
    > is shown in the e-mail and not all of the selections.
    >
    > The form is Posted to a PHP mailscript, listed here below.
    > I think I has to do this as a array (foreach) but I can't figure it
    > out...
    >
    > <?php
    >
    > @extract($_POST);
    > $email = stripslashes ($email);
    > $naam = stripslashes($naam);
    > $adres = stripslashes($adres);
    > $postcode = stripslashes($postcode);
    > $woonplaats = stripslashes($woonplaats);
    > $info = stripslashes($info);
    > $prijsindicat = stripslashes($prijsindicat);
    > $telnr = stripslashes($telnr);
    > $informatie = stripslashes($informatie); // This is the MultiSelection
    > $opmerkingen = stripslashes($opmerkingen);
    >
    > $body = "$naam heeft zojuist het formulier van de website
    > ingevuld.\n";
    > $body .= "\nAdres: $adres";
    > $body .= "\nPostcode: $postcode";
    > $body .= "\nWoonplaats: $woonplaats";
    > $body .= "\nInformatie sturen?: $info";
    > $body .= "\nPrijsindicatie sturen?: $prijsindicat";
    > $body .= "\nTelefoonnummer: $telnr\n";
    > $body .= "Informatie over: $informatie"; // This is the MultiSelection
    > $body .= "\nOpmerkingen: $opmerkingen";
    > mail('my@email.com',$subject,$body,"From: $naam <$email>");
    > header("location:email.htm");
    > ?>
    >
    > Who can give me some help on this one?
    >
    > Thanks.....
    >
    > Freebeeezz.....
    Freebeeezz Guest

  4. #3

    Default Re: Mail values from a List with Multiple Selections with PHP

    Well, I got the solution.... I gues I posted here so that anyone could
    use it..

    Add to your html multi-text [] to make it a "array"
    In HTML it should look like this: <select name="informatie[]"
    size="4" multiple id="informatie[]">

    Then in the mailscript you join everyting from the array together in a
    session:
    $informatie = join($informatie,", ");

    After that you can use the session $informatie as you like in the body
    of your mail.

    Have fun....



    [email]freebeeezz@hotmail.com[/email] (Freebeeezz) wrote in message news:<1313a966.0504130555.d183cc5@posting.google.c om>...
    > Nobody ???? :-(
    >
    >
    > [email]freebeeezz@hotmail.com[/email] (Freebeeezz) wrote in message news:<1313a966.0504112323.4b96e5ea@posting.google. com>...
    > > Hi,
    > >
    > > I have a little problem, I have a HTML-mailform with a List/Menu
    > > (named informatie) witch allows Multiple Selections (Hold CTRL-key and
    > > click mouse-button).
    > > When I test it and select some from the list only the last selection
    > > is shown in the e-mail and not all of the selections.
    > >
    > > The form is Posted to a PHP mailscript, listed here below.
    > > I think I has to do this as a array (foreach) but I can't figure it
    > > out...
    > >
    > > <?php
    > >
    > > @extract($_POST);
    > > $email = stripslashes ($email);
    > > $naam = stripslashes($naam);
    > > $adres = stripslashes($adres);
    > > $postcode = stripslashes($postcode);
    > > $woonplaats = stripslashes($woonplaats);
    > > $info = stripslashes($info);
    > > $prijsindicat = stripslashes($prijsindicat);
    > > $telnr = stripslashes($telnr);
    > > $informatie = stripslashes($informatie); // This is the MultiSelection
    > > $opmerkingen = stripslashes($opmerkingen);
    > >
    > > $body = "$naam heeft zojuist het formulier van de website
    > > ingevuld.\n";
    > > $body .= "\nAdres: $adres";
    > > $body .= "\nPostcode: $postcode";
    > > $body .= "\nWoonplaats: $woonplaats";
    > > $body .= "\nInformatie sturen?: $info";
    > > $body .= "\nPrijsindicatie sturen?: $prijsindicat";
    > > $body .= "\nTelefoonnummer: $telnr\n";
    > > $body .= "Informatie over: $informatie"; // This is the MultiSelection
    > > $body .= "\nOpmerkingen: $opmerkingen";
    > > mail('my@email.com',$subject,$body,"From: $naam <$email>");
    > > header("location:email.htm");
    > > ?>
    > >
    > > Who can give me some help on this one?
    > >
    > > Thanks.....
    > >
    > > Freebeeezz.....
    Freebeeezz 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