CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Adobe Flex (http://www.codingforums.com/forumdisplay.php?f=63)
-   -   want to send info from dropdown list via email (http://www.codingforums.com/showthread.php?t=249741)

akuria 01-25-2012 03:00 AM

want to send info from dropdown list via email
 
i have a html service sending input info collected on my site. it works great. now i have added several dropdown menus and i want to send that info as well and dont really know how.

here is my code for sending the info.

Code:

                        protected function submit_appointment_clickHandler():void
                        {
                                var Sender:String = "";
                                var Email:String = "";
                                var HomePhone:String = ""; 
                                var Date:String = "";
                                var Guests:String = "";
                                var School:String = "";
                                var Comments:String = "";
                                var Type:String = currentState;
                               
                                switch(currentState)
                                {
                                        case "home":
                                                Sender = promoFirstName.text + " " + promoLastName.text;
                                                Email = promoEmail.text;
                                                break;
                                        case "Reservation":
                                                Sender = resFirstName.text + " " + resLastName.text;
                                                Email = resEmail.text;
                                                HomePhone = resPhoneNumber.text; 
                                                Date = resDate.text;
                                                Guests = resGuests.text;
                                                School = resSchoolName.text;
                                                Comments = resDescription.text;
                                                break;
                                }   
                               
                                emailService.send(
                                        {
                                                senderName: Sender,
                                                senderEmail: Email,
                                                senderHomePhone: HomePhone,
                                                senderDate: Date,
                                                senderGuests: Guests,
                                                senderSchool: School,
                                                senderComments: Comments,
                                                senderTime: Time,
                                                senderEvent: Event,
                                                senderAbout: About,
                                                sendType: Type
                                        });
                        }
                        private function emailResult():void
                        {
                                Alert.show("Thank you for your submission. You will be contacted shortly.");
                                clearForm();
                        }
                        private function clearForm():void
                        {
                                promoFirstName.text = "";
                                promoLastName.text = "";
                                promoEmail.text = "";
                               
                                resFirstName.text = "";
                                resLastName.text = "";
                                resEmail.text = "";
                                resPhoneNumber.text = "";
                                resDate.text = "";
                                resGuests.text = "";
                                resSchoolName.text = "";
                                resDescription.text = "";
                        }

                ]]>

        </fx:Script>
        <s:states>
                <s:State name="home"/>
                <s:State name="ProtegeExperience"/>
                <s:State name="ourVenue"/>
                <s:State name="imageGallery"/>
                <s:State name="Reservation"/>
                <s:State name="Events"/>
                <s:State name="Contact"/>
                <s:State name="ourFans"/>
                <s:State name="Pricing"/>
        </s:states>
        <fx:Declarations>
                <s:HTTPService id="emailService"
                                          url="sendEmail.php"
                                          method="POST"
                                          resultFormat="xml"
                                          result="emailResult()"
                                          useProxy="false"/>
        </fx:Declarations>

here is my input fields and dropdown lists.

Code:

                <s:TextInput id="promoFirstName" x="80" y="478" focusColor="0xA60342" prompt="First Name" skinClass="components.promoFirstName"/>
                <s:TextInput id="promoLastName" x="204" y="478" focusColor="0xA60342" prompt="Last Name" skinClass="components.promoLastName"/>
                <s:TextInput id="promoEmail" x="80" y="502" focusColor="0xA60342" prompt="Email" skinClass="components.PromoEmail"/>
                <s:Button id="promoSubmit" x="257" y="527" buttonMode="true" skinClass="components.promoSubmit" click="submit_appointment_clickHandler()" d:userLabel="submit_appointment"/>

Code:

                <s:Button id="reservationSubmit" includeIn="Reservation" x="883" y="521" buttonMode="true" skinClass="components.reservationSubmit" click="submit_appointment_clickHandler()" d:userLabel="submit_appointment"/>
                <s:TextInput id="resFirstName" includeIn="Reservation" x="426" y="150" focusColor="#A60342" skinClass="components.reservationFirstName"/>
                <s:TextInput id="resLastName" includeIn="Reservation" x="715" y="150" focusColor="#A60342" skinClass="components.reservationLastName"/>
                <s:TextInput id="resDate" includeIn="Reservation" x="426" y="256" focusColor="#A60342" skinClass="components.reservationDate"/>
                <s:TextInput id="resGuests" includeIn="Reservation" x="426" y="307" focusColor="#A60342" skinClass="components.reservationGuests"/>
                <s:TextInput id="resSchoolName" includeIn="Reservation" x="427" y="366" focusColor="#A60342" skinClass="components.reservationSchoolName"/>
                <s:TextInput id="resDescription" includeIn="Reservation" x="428" y="421" focusColor="#A60342" skinClass="components.reservationDescription"/>
                <s:TextInput id="resEmail" includeIn="Reservation" x="427" y="203" focusColor="#A60342" skinClass="components.reservationEmail"/>
                <s:TextInput id="resPhoneNumber" includeIn="Reservation" x="716" y="203" focusColor="#A60342" skinClass="components.reservationPhoneNumber"/>
                <s:DropDownList id="resTime" includeIn="Reservation" x="716" y="255" width="140"
                                                focusColor="#A60342">
                        <s:ArrayCollection>
                                <fx:String>9am</fx:String>
                                <fx:String>11am</fx:String>
                                <fx:String>1pm</fx:String>
                                <fx:String>3pm</fx:String>
                                <fx:String>5pm</fx:String>
                                <fx:String>7pm</fx:String>
                        </s:ArrayCollection>
                </s:DropDownList>
                <s:DropDownList id="resEvent" includeIn="Reservation" x="716" y="308" width="208"
                                                focusColor="#A60342">
                        <s:ArrayCollection>
                                <fx:String>Pre-Prom Party</fx:String>
                                <fx:String>Graduation Event</fx:String>
                                <fx:String>High School Portrait</fx:String>
                                <fx:String>Couples Photo Session</fx:String>
                                <fx:String>Family Photos</fx:String>
                                <fx:String>Other</fx:String>
                        </s:ArrayCollection>
                </s:DropDownList>
                <s:DropDownList id="resAboutUs" includeIn="Reservation" x="716" y="372" width="208"
                                                focusColor="#A60342">
                        <s:ArrayCollection>
                                <fx:String>Friend</fx:String>
                                <fx:String>Word of Mouth</fx:String>
                                <fx:String>Online</fx:String>
                                <fx:String>Other</fx:String>
                        </s:ArrayCollection>
                </s:DropDownList>

here is my sendEmail.php

PHP Code:

<?php
    $senderName 
$_POST['senderName'];
    
$senderEmail =  $_POST['senderEmail'];
    
$senderHomePhone $_POST['senderHomePhone'];
    
$senderDate $_POST['senderDate'];
    
$senderGuests $_POST['senderGuests'];
    
$senderSchool $_POST['senderSchool'];
    
$senderComments $_POST['senderComments'];
    
$senderInterests $_POST['senderInterests'];
    
$sendType $_POST['sendType'];
    
$sendToEmail "info@protegeprom.com";
    
    
$recipient "$sendToEmail";
    
$subject "Web Contact: " $sendType " form";
    

    
$message "
    From: " 
$senderName ." \n
    Email Address: " 
$senderEmail "\n
    Home Phone: " 
$senderHomePhone "\n
    Date: " 
$senderDate "\n
    Number of Guests: " 
$senderGuests "\n
    School Name: " 
$senderSchool "\n  
    Zip Code: " 
$senderZipCode "\n
    
    Message: $senderComments\n
    Interests: $senderInterests"
;
    
    
$headers "From: " $senderEmail;
      
$message stripslashes($message);
     
    
mail($recipient$subject$message$headers)
?>

thanks for the help.

akuria 01-26-2012 02:08 AM

I finally got it to work. here is the new code for anyone wondering.

Code:

protected function submit_appointment_clickHandler():void
                        {
                                var Sender:String = "";
                                var Email:String = "";
                                var HomePhone:String = ""; 
                                var Date:String = "";
                                var Guests:String = "";
                                var School:String = "";
                                var Comments:String = "";
                                var Time:String = "";
                                var Event:String = "";
                                var About:String = "";
                                var Type:String = currentState;
                               
                                switch(currentState)
                                {
                                        case "home":
                                                Sender = promoFirstName.text + " " + promoLastName.text;
                                                Email = promoEmail.text;
                                                break;
                                        case "Reservation":
                                                Sender = resFirstName.text + " " + resLastName.text;
                                                Email = resEmail.text;
                                                HomePhone = resPhoneNumber.text; 
                                                Date = resDate.text;
                                                Guests = resGuests.text;
                                                School = resSchoolName.text;
                                                Time = resTime.selectedItem;
                                                Event = resEvent.selectedItem;
                                                About = resAbout.selectedItem;
                                                Comments = resDescription.text;
                                                break;
                                }   
                               
                                emailService.send(
                                        {
                                                senderName: Sender,
                                                senderEmail: Email,
                                                senderHomePhone: HomePhone,
                                                senderDate: Date,
                                                senderGuests: Guests,
                                                senderSchool: School,
                                                senderTime: Time,
                                                senderEvent: Event,
                                                senderAbout: About,
                                                senderComments: Comments,
                                                sendType: Type
                                        });
                        }
                        private function emailResult():void
                        {
                                Alert.show("Thank you for your submission. You will be contacted shortly.");
                                clearForm();
                        }
                        private function clearForm():void
                        {
                                promoFirstName.text = "";
                                promoLastName.text = "";
                                promoEmail.text = "";
                               
                                resFirstName.text = "";
                                resLastName.text = "";
                                resEmail.text = "";
                                resPhoneNumber.text = "";
                                resDate.text = "";
                                resGuests.text = "";
                                resSchoolName.text = "";
                                resDescription.text = "";
                                resTime.selectedIndex = -1;
                                resEvent.selectedIndex = -1;
                                resAbout.selectedIndex = -1;
                        }



All times are GMT +1. The time now is 07:07 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.