How to get value from drop down box to e-mail with php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kandi111777

    #1

    How to get value from drop down box to e-mail with php

    I have a form that includes a drop down box. I can get all of the other
    values to show up in an e-mail except for the drop down box values. Can
    someone please help? -- I know the HTML isn't the greatest. The website
    was originally created in FrontPage and the form broke. I'm just trying
    to help out and fix it for a friend.

    sendmail.php
    <?
    $Name = $_REQUEST['name'] ;
    $Comments = $_REQUEST['comments'] ;
    $Email = $_REQUEST['email'] ;
    $Telephone = $_REQUEST['telephone'];
    $Fax = $_REQUEST['fax'];
    $Subject = $_REQUEST['subject'];
    $SubjectOther = $_REQUEST['subjectother'];
    $ContactRequest ed = $_REQUEST['contactrequest ed'];

    mail( "kandihumpf@sit e-seeker.com", "RCI Waterjets Contact Us Form",
    "Name: $Name \n\nComments: $Comments \n\nEmail: $Email
    \n\nTelephone: $Telephone \n\nFax: $Fax \n\nSubject: $Subject
    \n\nSubject Other: $SubjectOther \n\nContact Requested:
    $ContactRequest ed", "From: kandihumpf@site-seeker.com" );
    header( "Location: http://www.rciwaterjet s.com/Thanks.htm" );
    ?>



    ContactUsNEW.ht m
    <form method="post" action="sendmai l.php">
    <p align="center">
    &nbsp;<texta rea name="comments" rows="8" cols="66">Pleas e Enter your
    details here</textarea></p>
    <dl>
    <dd>
    <table width="450">
    <tr>
    <td width="84" align="right">< font size="2">Name</font></td>
    <td width="286" align="center">
    <p align="center">
    &nbsp;<input name="name" type="text" size="35" maxlength="256"/></td>
    <td width="66">Requ ired</td>
    </tr>
    <tr>
    <td width="84" align="right">< font size="2">E-mail</font></td>
    <td width="286" align="center">
    <p align="center">
    <input name="email" type="text" size="35" maxlength="256"/></td>
    <td width="66">Opti onal</td>
    </tr>
    <tr>
    <td width="84" align="right">< font size="2">Tel</font></td>
    <td width="286" align="center">
    <p align="center">
    &nbsp;<input name="telephone " type="text" size="35"
    maxlength="256"/></td>
    <td width="66">Opti onal</td>
    </tr>
    <tr>
    <td width="84" align="right">< font size="2">Fax</font></td>
    <td width="286" align="center">
    <p align="center">
    <input name="fax" type="text" size="35" maxlength="256"/></td>
    <td width="66">Opti onal</td>
    </tr>
    </table>
    </dd>
    </dl>
    <dl>
    <dd>
    <table width="448">
    <tr>
    <td width="88" align="right">< select name="Subject" size="1">
    <option selected>Web Site</option>
    <option>Company </option>
    <option>Product s</option>
    <option>Store </option>
    <option>Employe e</option>
    <option>(Other) </option>
    </select> </td>
    <td width="38">
    <p align="center"> <font size="2">Other: </font></td>
    <td width="252">
    <input name="subjectot her" type="text" size="35"
    maxlength="256"/></td>
    <td width="52">&nbs p;</td>
    </tr>
    <tr>
    <td width="88" align="right">& nbsp;</td>
    <td width="351" colspan="3">&nb sp;</td>
    </tr>
    <tr>
    <td width="88" align="right">< input name="contactre quested"
    type="checkbox" ></td>
    <td width="351" colspan="3">
    <p align="center"> Please contact me as soon as possible regarding
    this matter.</td>
    </tr>
    <tr>
    <td width="442" align="right" colspan="4">
    <p align="center"> <input type="submit"/><input type="reset"
    value="Reset" name="B2"></td>
    </tr>
    </table>
    </dd>
    </dl>
    <p
    align="center"> &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;&nbsp;&nbsp; &nbsp;&nbsp;&nb sp;
    </p>
    </form>

  • Syl

    #2
    Re: How to get value from drop down box to e-mail with php


    kandi111777 wrote:[color=blue]
    > I have a form that includes a drop down box. I can get all of the other
    > values to show up in an e-mail except for the drop down box values. Can
    > someone please help? -- I know the HTML isn't the greatest. The website
    > was originally created in FrontPage and the form broke. I'm just trying
    > to help out and fix it for a friend.
    >
    > sendmail.php
    > $Subject = $_REQUEST['subject'];
    > <td width="88" align="right">< select name="Subject" size="1">
    > <option selected>Web Site</option>
    > <option>Company </option>
    > <option>Product s</option>
    > <option>Store </option>
    > <option>Employe e</option>
    > <option>(Other) </option>
    > </select> </td>[/color]


    You're missing a value in the option of the drop down

    Change all the options like this --> <option>Company </option>
    to this --> <option value="company" >Company</option>
    to this --> <option value="employee ">Employee</option>

    etc, etc,

    Comment

    • kandi111777

      #3
      Re: How to get value from drop down box to e-mail with php

      I made the changes so now it looks like this:

      <td width="88" align="right">< select name="Subject" size="1">
      <option selected value="website" >Web Site</option>
      <option value="company" >Company</option>
      <option value="products ">Products</option>
      <option value="store">S tore</option>
      <option value="employee ">Employee</option>
      <option value="other">O ther</option>
      </select> </td>

      But it still isn't working. My e-mail looks like this:

      Name: Kandi M. Humpf
      Comments: test
      Email: kandi@kandiandk eith.com
      Telephone: 315-292-6819
      Fax: 3157353994
      Subject:
      Subject Other:
      Contact Requested: on

      Do you have another suggestion?

      Syl wrote:[color=blue]
      > You're missing a value in the option of the drop down
      >
      > Change all the options like this --> <option>Company </option>
      > to this --> <option value="company" >Company</option>
      > to this --> <option value="employee ">Employee</option>
      >
      > etc, etc,[/color]

      Comment

      • kandi111777

        #4
        Re: How to get value from drop down box to e-mail with php

        Thanks! It works now...I had to change:

        <select name="selectite m" size="1">

        and

        $Subject = $_POST['selectitem'];

        Okay, now do you happen to know how to BCC a recipient?

        Comment

        • Kimmo Laine

          #5
          Re: How to get value from drop down box to e-mail with php

          "Syl" <david.hunter@g mail.com> wrote in message
          news:1151631503 .326607.307760@ y41g2000cwy.goo glegroups.com.. .[color=blue]
          >
          > kandi111777 wrote:[color=green]
          >> I have a form that includes a drop down box. I can get all of the other
          >> values to show up in an e-mail except for the drop down box values. Can
          >> someone please help? -- I know the HTML isn't the greatest. The website
          >> was originally created in FrontPage and the form broke. I'm just trying
          >> to help out and fix it for a friend.
          >>
          >> sendmail.php
          >> $Subject = $_REQUEST['subject'];
          >> <td width="88" align="right">< select name="Subject" size="1">
          >> <option selected>Web Site</option>
          >> <option>Company </option>
          >> <option>Product s</option>
          >> <option>Store </option>
          >> <option>Employe e</option>
          >> <option>(Other) </option>
          >> </select> </td>[/color]
          >
          >
          > You're missing a value in the option of the drop down
          >
          > Change all the options like this --> <option>Company </option>
          > to this --> <option value="company" >Company</option>
          > to this --> <option value="employee ">Employee</option>
          >[/color]


          That's not an issue, if value is not given, then anything that's inside the
          <option></option> will be used instead. In this case for example
          <option>Company </option> Company will be used since it lacks value.

          --
          "ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
          spam@outolempi. net | Gedoon-S @ IRCnet | rot13(xvzzb@bhg byrzcv.arg)


          Comment

          • Geoff Berrow

            #6
            Re: How to get value from drop down box to e-mail with php

            Message-ID: <1151638485.258 930.165200@h44g 2000cwa.googleg roups.com> from
            kandi111777 contained the following:
            [color=blue]
            ><select name="selectite m" size="1">
            >
            >and
            >
            >$Subject = $_POST['selectitem'];[/color]

            All you really had to do was make sure they were the same case. You had
            $Subject = $_REQUEST['subject'];
            and
            <select name="Subject" size="1">[color=blue]
            >
            >Okay, now do you happen to know how to BCC a recipient?[/color]

            mail( "kandihumpf@sit e-seeker.com", "RCI Waterjets Contact Us Form",
            "Name: $Name \n\nComments: $Comments \n\nEmail: $Email
            \n\nTelephone: $Telephone \n\nFax: $Fax \n\nSubject: $Subject
            \n\nSubject Other: $SubjectOther \n\nContact Requested:
            $ContactRequest ed", "From: kandihumpf@site-seeker.com
            \nBcc:me@exampl e.com" );

            Doesn't work on some setups though. Check with your service provider.

            --
            Geoff Berrow (put thecat out to email)
            It's only Usenet, no one dies.
            My opinions, not the committee's, mine.
            Simple RFDs http://www.ckdog.co.uk/rfdmaker/

            Comment

            • Jonathan N. Little

              #7
              Re: How to get value from drop down box to e-mail with php

              Kimmo Laine wrote:
              "Syl" <david.hunter@g mail.comwrote in message
              news:1151631503 .326607.307760@ y41g2000cwy.goo glegroups.com.. .
              >kandi111777 wrote:
              >>I have a form that includes a drop down box. I can get all of the other
              >>values to show up in an e-mail except for the drop down box values. Can
              >>someone please help? -- I know the HTML isn't the greatest. The website
              >>was originally created in FrontPage and the form broke. I'm just trying
              >>to help out and fix it for a friend.
              >>>
              >>sendmail.ph p
              >> $Subject = $_REQUEST['subject'];
              >> <td width="88" align="right">< select name="Subject" size="1">
              >> <option selected>Web Site</option>
              >> <option>Company </option>
              >><option>Produ cts</option>
              >> <option>Store </option>
              >> <option>Employe e</option>
              >> <option>(Other) </option>
              >> </select</td>
              >>
              >You're missing a value in the option of the drop down
              >>
              >Change all the options like this --<option>Company </option>
              >to this --<option value="company" >Company</option>
              >to this --<option value="employee ">Employee</option>
              >>
              >
              >
              That's not an issue, if value is not given, then anything that's inside the
              <option></optionwill be used instead. In this case for example
              <option>Company </optionCompany will be used since it lacks value.
              >
              Browser dependent, MS IE doesn't set the value by default. It really
              becomes noticeable in JavaScript if you test for someSelectEleme nt.value
              will fail in IE if you do not explicitly set the value attributes on the
              OPTION elements...

              --
              Take care,

              Jonathan
              -------------------
              LITTLE WORKS STUDIO

              Comment

              • John Dunlop

                #8
                Re: How to get value from drop down box to e-mail with php

                Jonathan N. Little:
                Kimmo Laine wrote:
                >
                That's not an issue, if value is not given, then anything that's inside the
                <option></optionwill be used instead. In this case for example
                <option>Company </optionCompany will be used since it lacks value.
                >
                Browser dependent, MS IE doesn't set the value by default. It really
                becomes noticeable in JavaScript if you test for someSelectEleme nt.value
                will fail in IE if you do not explicitly set the value attributes on the
                OPTION elements...
                not disputing that, but I'd point out that the spec is quite clear
                when it says, as Kimmo said, that in the absence of a value attribute,
                the value is set to the element's content.

                --
                Jock

                Comment

                Working...