Comunidad de diseño web y desarrollo en internet online

¿Como manejo combobox en formulario de contacto?

Citar            
MensajeEscrito el 24 Oct 2009 05:26 am
que tal, ya que pude resolver mi problema del clima gracias a Dios ahora tengo un problema con un combobox ya que no me imprime el resultado en el correo enviado, solo ese me falla, les dejo el codigo AS para que vean si cometo un error al igual que el codigo PHP para poder imprimir el resultado elegido en el combobox, gracias de antemano Dios los bendiga :lol:

Código ActionScript :

myComboBox.setStyle("themeColor","0xC4D1D2");
myComboBox.setStyle("backgroundColor","0xD8E0E1");
myComboBox.setStyle("borderColor","0x333333");
//myComboBox.setStyle("borderStyle", "outset");
myComboBox.setStyle("color","0x161616");
//myComboBox.setStyle("disabledColor", "haloOrange");
myComboBox.setStyle("fontFamily","Arial");
myComboBox.setStyle("fontSize","12");
//myComboBox.setStyle("fontStyle", "italic");
//myComboBox.setStyle("fontWeight", "bold");
myComboBox.setStyle("highlightColor","0xFFFFFF");
myComboBox.setStyle("marginLeft","15");
myComboBox.setStyle("marginRight","5");
myComboBox.rowCount = 5;



// Import the combo box class
import mx.controls.ComboBox;

// Define your combo box instance as a combo box
var myComboBox:ComboBox;

// Add items to your combo box......first parameter is the label that
// the user sees. Second parameter is the data of that item. The data
// parameter is where you can put your url....for example.
//myComboBox.addItem("Angola","http://actionscript.org/");
myComboBox.addItem("Sencilla");
myComboBox.addItem("Doble");
myComboBox.addItem("Suite Junior");
myComboBox.addItem("Suite Master");

// Tell the combo change method to fire when the change event is
// fired by the combo box
myComboBox.addEventListener("change",onComboChange);

// Method called by the change event listener
function onComboChange(event:Object):Void {
   // Get the label and the data properties from the event object passed in
   // to this method by the change event
   var label:String = event.target.selectedItem.label;
   var data:String = event.target.selectedItem.data;

   // Trace the value to check it out
   trace("label : "+label);
   trace("data : "+data);
   comboBox = label;

   // Go to that url that is on the data property
   //getURL (data, "_self");
}

var cbPaises:String;
trace(cbPaises);
/* myComboBox final
===========================================*/
enviar = function ()
{
   if (txtNombre.text.length &&
      txtApellidos.length &&
      txtTelefono.length &&
      txtCiudad.length &&
      txtEstado.length &&
      txtPais.length &&
      txtEmail.length &&
      txtDiallegada.length &&
      txtMesllegada.length &&
      txtAnollegada.length &&
      txtDiapartida.length &&
      txtMespartida.length &&
      txtAnopartida.length &&
      txtHabitaciones.length &&
      txtMensaje.length)
   {
      if (txtEmail.text.indexOf("@") != -1 && txtEmail.text.indexOf(".") != -1)
      {
         form_lv = new LoadVars();
         form_lv.nombre = txtNombre.text;
         form_lv.apellidos = txtApellidos.text;
         form_lv.telefono = txtTelefono.text;
         form_lv.ciudad = txtPais.text;
         form_lv.estado = txtEstado.text;
         form_lv.pais = txtPais.text;
         form_lv.mail = txtEmail.text;
         form_lv.diallegada = txtDiallegada.text;
         form_lv.mesllegada = txtMesllegada.text;
         form_lv.anollegada = txtAnollegada.text;
         form_lv.diapartida = txtDiapartida.text;
         form_lv.mespartida = txtMespartida.text;
         form_lv.anopartida = txtAnopartida.text;
         form_lv.habitaciones = txtHabitaciones.text;
         form_lv.mensaje = txtMensaje.text;
         form_lv.titulo = "Mensaje de Sitio Web American Inn Hotel & Suites";
         form_lv.sendAndLoad("send.php", form_lv, "POST");
         txtInfo.text = "Enviando Mensaje..";
         form_lv.onLoad = function() 
         {
            if (this.estatus == "ok")
            {
               txtNombre.text = "";
               txtApellidos.text = "";
               txtTelefono.text = "";
               txtCiudad.text = "";
               txtEstado.text = "";
               txtPais.text = "";
               txtEmail.text = "";
               txtDiallegada.text = "";
               txtMesllegada.text = "";
               txtAnollegada.text = "";
               txtDiapartida.text = "";
               txtMespartida.text = "";
               txtAnopartida.text = "";
               txtHabitaciones.text = "";
               txtMensaje.text = "";
               txtInfo.text = "OK, tu mensaje ha sido enviado";
            }
            else
            {
               txtInfo.text = "Problemas con el servidor";
            }
         };
      }
      else
      {
         txtInfo.text = "Email Invalido";
      }
   }
   else
   {
      txtInfo.text = "Debes llenar todos los datos";
   }
};

borrar = function () 
{
   txtNombre.text = "";
   txtApellidos.text = "";
   txtTelefono.text = "";
   txtCiudad.text = "";
   txtEstado.text = "";
   txtPais.text = "";
   txtEmail.text = "";
   txtDiallegada.text = "";
   txtMesllegada.text = "";
   txtAnollegada.text = "";
   txtDiapartida.text = "";
   txtMespartida.text = "";
   txtAnopartida.text = "";
   txtHabitaciones.text = "";
   txtMensaje.text = "";
};

btnEnviar.onRelease = enviar;
btnBorrar.onRelease = borrar;

stop();


Código PHP :

<?php
   $titulo="Mensaje de SITIO WEB American Inn Hotel & Suites";
   $nombre=utf8_decode($_POST['nombre']);
   $apellidos=utf8_decode($_POST['apellidos']);
   $telefono=utf8_decode($_POST['telefono']);
   $estado=utf8_decode($_POST['estado']);
   $ciudad=utf8_decode($_POST['ciudad']);
   $pais=utf8_decode($_POST['pais']);
   $mail=utf8_decode($_POST['mail']);
   $diallegada=utf8_decode($_POST['diallegada']);
   $mesllegada=utf8_decode($_POST['mesllegada']);
   $anollegada=utf8_decode($_POST['anollegada']);
   $diapartida=utf8_decode($_POST['diapartida']);
   $mespartida=utf8_decode($_POST['mespartida']);
   $anopartida=utf8_decode($_POST['anopartida']);
   $habitaciones=utf8_decode($_POST['habitaciones']);
   $myComboBox=utf8_decode($_POST['myCombobox']);
   $mensaje=utf8_decode($_POST['mensaje']);
   $mymail = "[email protected]";
   $ccmail = "[email protected]";
   $header = "From: $nombre <$mail>";
   $contenido = "Has recibido un mensaje acerca de SITIO WEB American Inn Hotel & Suites\n"
   ."A continuación se muestran\n"
   ."los datos:\n\n"
   ."Nombre: $nombre\n"
   ."Apellidos: $apellidos\n"
   ."Telefono: $telefono\n"
   ."Estado: $estado\n"
   ."Ciudad: $ciudad\n"
   ."Pais: $pais\n"
   ."Email: $mail\n\n"
   ."Fecha de llegada:\n"
   ."Dia: $diallegada\n"
   ."Mes: $mesllegada\n"
   ."Año: $anollegada\n\n"
   ."Fecha de partida:\n"
   ."Dia: $diapartida\n"
   ."Mes: $mespartida\n"
   ."Año: $anopartida\n\n"
   ."Habitaciones: $habitaciones\n\n"
   ."Tipo de Habitación: $ComboBox\n\n"
   ."Mensaje:\n$mensaje\n\n"
   ."Gracias";
   mail($ccmail, $titulo, $contenido ,$header);
   if(mail($mymail, $titulo, $contenido ,$header))
      echo "&estatus=ok&";
?>

Por alexstorm

45 de clabLevel



Genero:Masculino  

firefox
Citar            
MensajeEscrito el 24 Oct 2009 07:00 am
Por lo que veo ya me funciono pero sin embargo me sale como que no lo mande, cuando en realidad si manda y me acepta la el valor del comboBox, les dejo aqui el codigo del AS para que alguien me pueda dar una pequeña correccion en mi script. Gracias!

Código ActionScript :

meses=["Sencilla","Doble","Suite Junior","Suite Master"];
Cuarto.dataProvider=meses;
Cuarto.rowCount=4;
enviar = function ()
{
   if (txtNombre.text.length &&
      txtApellidos.length &&
      txtTelefono.length &&
      txtCiudad.length &&
      txtEstado.length &&
      txtPais.length &&
      txtEmail.length &&
      txtDiallegada.length &&
      txtMesllegada.length &&
      txtAnollegada.length &&
      txtDiapartida.length &&
      txtMespartida.length &&
      txtAnopartida.length &&
      txtHabitaciones.length &&
      Cuarto.length &&
      txtMensaje.length)
   {
      if (txtEmail.text.indexOf("@") != -1 && txtEmail.text.indexOf(".") != -1)
      {
         form_lv = new LoadVars();
         form_lv.nombre = txtNombre.text;
         form_lv.apellidos = txtApellidos.text;
         form_lv.telefono = txtTelefono.text;
         form_lv.ciudad = txtPais.text;
         form_lv.estado = txtEstado.text;
         form_lv.pais = txtPais.text;
         form_lv.mail = txtEmail.text;
         form_lv.diallegada = txtDiallegada.text;
         form_lv.mesllegada = txtMesllegada.text;
         form_lv.anollegada = txtAnollegada.text;
         form_lv.diapartida = txtDiapartida.text;
         form_lv.mespartida = txtMespartida.text;
         form_lv.anopartida = txtAnopartida.text;
         form_lv.habitaciones = txtHabitaciones.text;
         form_lv.tipo = _root.Cuarto.value;
         form_lv.mensaje = txtMensaje.text;
         form_lv.titulo = "Mensaje de Sitio Web American Inn Hotel & Suites";
         form_lv.sendAndLoad("send.php", form_lv, "POST");
         txtInfo.text = "Enviando Mensaje..";
         form_lv.onLoad = function() 
         {
            if (this.estatus == "ok")
            {
               txtNombre.text = "";
               txtApellidos.text = "";
               txtTelefono.text = "";
               txtCiudad.text = "";
               txtEstado.text = "";
               txtPais.text = "";
               txtEmail.text = "";
               txtDiallegada.text = "";
               txtMesllegada.text = "";
               txtAnollegada.text = "";
               txtDiapartida.text = "";
               txtMespartida.text = "";
               txtAnopartida.text = "";
               txtHabitaciones.text = "";
               tipo.text = "";
               txtMensaje.text = "";
               txtInfo.text = "OK, tu mensaje ha sido enviado";
            }
            else
            {
               txtInfo.text = "Problemas con el servidor";
            }
         };
      }
      else
      {
         txtInfo.text = "Email Invalido";
      }
   }
   else
   {
      txtInfo.text = "Debes llenar todos los datos";
   }
};

borrar = function () 
{
   txtNombre.text = "";
   txtApellidos.text = "";
   txtTelefono.text = "";
   txtCiudad.text = "";
   txtEstado.text = "";
   txtPais.text = "";
   txtEmail.text = "";
   txtDiallegada.text = "";
   txtMesllegada.text = "";
   txtAnollegada.text = "";
   txtDiapartida.text = "";
   txtMespartida.text = "";
   txtAnopartida.text = "";
   txtHabitaciones.text = "";
   tipo = _root.Cuarto.value;
   txtMensaje.text = "";
};

btnEnviar.onRelease = enviar;
btnBorrar.onRelease = borrar;

stop();

Por alexstorm

45 de clabLevel



Genero:Masculino  

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.