2014-03-06 2 views
0

기본 PHP 이메일 프로세서의 내부에 var의 형태가 있습니다. checkbox 태그가 있는데 문제는 HTML 문서에 2checkbox 태그가있는 것입니다. 사용자는 그 중 몇 가지를 선택하려고합니다.PHP에서 유용하지 않은 병을 숨기기

어떻게 숨기거나 HTML 나타나서 고객이 그들 중 단지 몇 함께 흰색 간격 목록 대신 선택한 checkbox을 보여 내 고객 이메일로이 form를받을 때 PHP var 지금이야 제거 할 수 있습니까? 또는 HTML에서 JS로해야합니까? 여기

내 코드 :

<?php 

// ******* PROCESS EMAILS 
$emailSubject = 'Solicitud de Servicio ERASE - '.$_POST['nombreNovia']; 
$webMaster = '[email protected]'; 


// INFO. DE LA NOVIA 
$nombreNovia = $_POST['nombreNovia']; 
$domicilioNovia = $_POST['domicilioNovia']; 
$ciudadNovia = $_POST['ciudadNovia']; 
$emailNovia = $_POST['emailNovia']; 
$celularNovia = $_POST['celularNovia']; 
$telefonoNovia = $_POST['telefonoNovia']; 
$lugarNacimientoNovia = $_POST['lugarNacimientoNovia']; 
$fechaNacimientoNovia = $_POST['fechaNacimientoNovia']; 
$religionNovia = $_POST['religionNovia']; 
$profesionNovia = $_POST['profesionNovia']; 
$anteriorNovia = $_POST['anteriorNovia']; 


// INFO. DEL NOVIO 
$nombreNovio = $_POST['nombreNovio']; 
$domicilioNovio = $_POST['domicilioNovio']; 
$ciudadNovio = $_POST['ciudadNovio']; 
$emailNovio = $_POST['emailNovio']; 
$celularNovio = $_POST['celularNovio']; 
$telefonoNovio = $_POST['telefonoNovio']; 
$lugarNacimientoNovio = $_POST['lugarNacimientoNovio']; 
$fechaNacimientoNovio = $_POST['fechaNacimientoNovio']; 
$religionNovio = $_POST['religionNovio']; 
$profesionNovio = $_POST['profesionNovio']; 
$anteriorNovio = $_POST['anteriorNovio']; 


// INFO. DEL EVENTO 
$tipoEvento = $_POST['tipoEvento']; 
$lugarEvento = $_POST['lugarEvento']; 
$fechaEvento = $_POST['fechaEvento']; 
$numeroInvitados = $_POST['numeroInvitados']; 
$porcentajeForaneos = $_POST['porcentajeForaneos']; 

$tipoCeremonia = $_POST['tipoCeremonia']; 
$numeroInvitadosCeremonia = $_POST['numeroInvitadosCeremonia']; 
$numeroHorasCeremonia = $_POST['numeroHorasCeremonia']; 
$desdeCeremonia = $_POST['desdeCeremonia']; 
$hastaCeremonia = $_POST['hastaCeremonia']; 

$tipoRecepcion = $_POST['tipoRecepcion']; 
$numeroInvitadosRecepcion = $_POST['numeroInvitadosRecepcion']; 
$numeroHorasRecepcion = $_POST['numeroHorasRecepcion']; 
$desdeRecepcion = $_POST['desdeRecepcion']; 
$hastaRecepcion = $_POST['hastaRecepcion']; 

$diasEvento = $_POST['diasEvento']; 
$pedida = $_POST['pedida']; 
$despedida = $_POST['despedida']; 
$ensayo = $_POST['ensayo']; 
$tornaboda = $_POST['tornaboda']; 

$hotelesSede = $_POST['hotelesSede']; 
$plan = $_POST['plan']; 


// DEFINIENDO EL EVENTO 
$eventoFormal = $_POST['eventoFormal']; 
$eventoSemiformal = $_POST['eventoSemiformal']; 
$eventoCasual = $_POST['eventoCasual']; 

$atmosferaElegante = $_POST['atmosferaElegante']; 
$atmosferaTradicional = $_POST['atmosferaTradicional']; 
$atmosferaTematica = $_POST['atmosferaTematica']; 
$atmosferaDivertida = $_POST['atmosferaDivertida']; 

$banqueteEmplatado = $_POST['banqueteEmplatado']; 
$banqueteBuffet = $_POST['banqueteBuffet']; 
$banqueteCoktail = $_POST['banqueteCoktail']; 
$banqueteTiempos = $_POST['banqueteTiempos']; 

$decoracionClasico = $_POST['decoracionClasico']; 
$decoracionRomantico = $_POST['decoracionRomantico']; 
$decoracionMinimalista = $_POST['decoracionMinimalista']; 
$decoracionVintage = $_POST['decoracionVintage']; 
$decoracionModerno = $_POST['decoracionModerno']; 
$decoracionCaribeño = $_POST['decoracionCaribeño']; 
$tematico = $_POST['tematico']; 

$color1 = $_POST['color1']; 
$color2 = $_POST['color2']; 

$prioridades = $_POST['prioridades']; 
$noDeseado = $_POST['noDeseado']; 


// SERVICIOS A MANEJAR 
$servicioBanquete = $_POST['servicioBanquete']; 
$ServicioDecoracion = $_POST['ServicioDecoracion']; 
$ServicioPirotecnia = $_POST['ServicioPirotecnia']; 
$servicioBebidas = $_POST['servicioBebidas']; 
$ServicioEdecanes = $_POST['ServicioEdecanes']; 
$servicioPostres = $_POST['servicioPostres']; 
$servicioImpresos = $_POST['servicioImpresos']; 
$servicioPastel = $_POST['servicioPastel']; 
$servicioFlores = $_POST['servicioFlores']; 
$servicioCotillones = $_POST['servicioCotillones']; 
$servicioAnimacion = $_POST['servicioAnimacion']; 
$servicioMobiliario = $_POST['servicioMobiliario']; 
$servicioFavors = $_POST['servicioFavors']; 
$servicioIluminacion = $_POST['servicioIluminacion']; 
$servicioDj = $_POST['servicioDj']; 
$servicioGrupoMusical = $_POST['servicioGrupoMusical']; 
$servicioPlantaLuz = $_POST['servicioPlantaLuz']; 
$servicioMusicaAmbiental = $_POST['servicioMusicaAmbiental']; 
$servicioMesaDulces = $_POST['servicioMesaDulces']; 
$servicioFotoVideo = $_POST['servicioFotoVideo']; 
$servicioRentaAutos = $_POST['servicioRentaAutos']; 
$servicioValetParking = $_POST['servicioValetParking']; 

// INVERSION 
$presupuesto = $_POST['presupuesto']; 
$otrasAgencias = $_POST['otrasAgencias']; 
$notas = $_POST['notas']; 


    ob_start(); 

?> 

<body style="font-size: 14px; font-family: sans-serif; margin: 0px; padding: 0px; color: #4D4D4D; background-color: #FAFAFA; -moz-box-sizing:border-box; box-sizing:border-box;"> 
    <div style="width: 100%; padding-left: 24px; padding-top: 24px; padding-bottom: 24px; background-color: #4D4D4D; -moz-box-sizing:border-box; box-sizing:border-box;"> 
     <img src="http://www.erase.com.mx/erase/email/img/logoEmail.png" alt="Logo ERASE"> 
    </div> 
    <div style="padding: 0px 24px; -moz-box-sizing:border-box; box-sizing:border-box;"> 
     <h1 style="text-align: center; font-size: 2.4em; line-height: 5em; font-weight: bold;">Solicitud de Servicio</h1> 

     <div style="width: 100%; text-align: left; margin-bottom: 48px; -moz-box-sizing:border-box; box-sizing:border-box;"> 
      <h2 style="text-align: left; font-size: 1.3em; width: 100%; margin-bottom: 20px;">INFO. DE LA NOVIA</h2> 
      <p style="margin-left: 12px;"> 
       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">NOMBRE:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$nombreNovia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">DOMICILIO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$domicilioNovia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">CIUDAD:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$ciudadNovia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">EMAIL:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$emailNovia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">CELULAR:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$celularNovia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">TELEFONO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$telefonoNovia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">LUGAR DE NACIMIENTO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$lugarNacimientoNovia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">FECHA DE NACIMIENTO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$fechaNacimientoNovia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">RELIGION:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$religionNovia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">PROFESION:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$profesionNovia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">EVENTO ANTERIOR:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$anteriorNovia</span><br/><br/> 
      </p> 
     </div> 

     <div style="width: 100%; text-align: left; margin-bottom: 48px; -moz-box-sizing:border-box; box-sizing:border-box;"> 
      <h2 style="text-align: left; font-size: 1.3em; width: 100%; margin-bottom: 20px;">INFO. DEL NOVIO</h2> 
      <p style="margin-left: 12px;"> 
       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">NOMBRE:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$nombreNovio</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">DOMICILIO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$domicilioNovio</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">CIUDAD:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$ciudadNovio</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">EMAIL:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$emailNovio</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">CELULAR:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$celularNovio</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">TELEFONO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$telefonoNovio</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">LUGAR DE NACIMIENTO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$lugarNacimientoNovio</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">FECHA DE NACIMIENTO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$fechaNacimientoNovio</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">RELIGION:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$religionNovio</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">PROFESION:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$profesionNovio</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">EVENTO ANTERIOR:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$anteriorNovio</span><br/><br/> 
      </p> 
     </div> 

     <div style="width: 100%; text-align: left; margin-bottom: 48px; -moz-box-sizing:border-box; box-sizing:border-box;"> 
      <h2 style="text-align: left; font-size: 1.3em; width: 100%; margin-bottom: 20px;">INFO. DEL EVENTO</h2> 
      <p style="margin-left: 12px;"> 
       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">TIPO DE EVENTO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$tipoEvento</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">LUGAR DEL EVENTO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$lugarEvento</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">FECHA DEL EVENTO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$fechaEvento</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">NUMERO DE INVITADOS:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$numeroInvitados</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">% DE FORANEOS:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$porcentajeForaneos</span><br/><br/> 

      <span style="font-size: 1em; color: #888888; line-height: 3em;">CEREMONIA</span><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">TIPO DE CEREMONIA:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$tipoCeremonia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">NUMERO DE INVITADOS:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$numeroInvitadosCeremonia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">NUMERO DE HORAS:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$numeroHorasCeremonia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">DESDE LAS:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$desdeCeremonia</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">HASTA LAS:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$hastaCeremonia</span><br/><br/> 

      <span style="font-size: 1em; color: #888888; line-height: 3em;">RECEPCION</span><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">TIPO DE RECEPCION:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$tipoRecepcion</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">NUMERO DE INVITADOS:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$numeroInvitadosRecepcion</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">NUMERO DE HORAS:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$numeroHorasRecepcion</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">DESDE LAS:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$desdeRecepcion</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">HASTA LAS:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$hastaRecepcion</span><br/><br/> 

      <span style="font-size: 1em; color: #888888; line-height: 3em;">EVENTO</span><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">DIAS DE EVENTO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$diasEvento</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">PEDIDA:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$pedida</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">DESPEDIDA:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$despedida</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">ENSAYO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$ensayo</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">TORNABODA:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$tornaboda</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">HOTELES SEDE:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$hotelesSede</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">PLAN:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$plan</span><br/><br/> 
      </p> 
     </div> 

     <div style="width: 100%; text-align: left; margin-bottom: 48px; -moz-box-sizing:border-box; box-sizing:border-box;"> 
      <h2 style="text-align: left; font-size: 1.3em; width: 100%; margin-bottom: 20px;">DEFINIENDO EL EVENTO</h2> 
      <p style="margin-left: 12px;"> 
       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">ESTILO DEL EVENTO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$eventoFormal</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$eventoSemiformal</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$eventoCasual</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">ATMOSFERA DESEADA:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$atmosferaElegante</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$atmosferaTradicional</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$atmosferaTematica</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$atmosferaDivertida</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">TIPO DE BANQUETE:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$banqueteEmplatado</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$banqueteBuffet</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$banqueteCoktail</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$banqueteTiempos tiempos</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">ESTILO DE DECORACION:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$decoracionClasico</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$decoracionRomantico</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$decoracionMinimalista</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$decoracionVintage</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$decoracionModerno</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$decoracionCaribeño</span><br/><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$tematico</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">COLORES BASE:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$color1 y $color2</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">PRIORIDADES DEL EVENTO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$prioridades</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">NO DESEADO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$noDeseado</span><br/><br/> 
      </p> 
     </div> 

     <div style="width: 100%; text-align: left; margin-bottom: 48px; -moz-box-sizing:border-box; box-sizing:border-box;"> 
      <h2 style="text-align: left; font-size: 1.3em; width: 100%; margin-bottom: 20px;">SERVICIOS A MANEJAR</h2> 
      <p style="margin-left: 12px;"> 
       <?php 
        foreach ($_POST as $key => $value) { 
         if (strtolower(substr($key, 0, 8)) == 'servicio' && !empty($value)) { 
          ?> 
           <span class="answer" style="margin-left: 6px; line-height: 1.4em;"><?php echo $value; ?></span><br/><br/> 
          <?php 
         } 
        } 
       ?> 
      </p> 
     </div> 

     <div style="width: 100%; text-align: left; margin-bottom: 48px; -moz-box-sizing:border-box; box-sizing:border-box;"> 
      <h2 style="text-align: left; font-size: 1.3em; width: 100%; margin-bottom: 20px;">PRESUPUESTO</h2> 
      <p style="margin-left: 12px;"> 
       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">PRESUPUESTO:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$presupuesto</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">YA HE COTIZADO CON:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$otrasAgencias</span><br/><br/> 

       <span class="label" style="font-size: .8em; color: #888888; line-height: 1.2em;">NOTAS:</span><br/> 
       <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$notas</span><br/><br/> 
      </p> 
     </div> 

    </div> 
<body> 
<?php 

    $body = ob_get_clean(); 

$headers = "From: $emailNovia\r\n"; 
$headers .= "Content-type: text/html\r\n"; 
$success = mail($webMaster, $emailSubject, $body, $headers); 


// ******* PROCESS EMAILS 
//$message = "Gracias por contactarnos. Nos pondremos en contacto con usted cuanto antes<br />Atte:<br />(Lic. Cristina Madrid)"; 
//$subject = "¡Gracias por escribirnos!"; 

//$headers2 = "From: $webmaster\r\n"; 
//$headers2 .= "Content-type: text/html\r\n"; 
//mail($leademail, $subject, $message, $headers2); 


// ******* REDIRECTION 
header('Location: http://www.erase.com.mx/index.html') 
?> 
+0

가 비어있는 경우를 포함하지 않는다? – Doon

+0

정말 루프를 사용해야합니다. – luxcem

+0

예 @Doon과 어떻게 포함시키지 않습니까? 그게 정확히 내 질문 – Kunoxs

답변

0

당신은 배열을 생성하고 키가 자동으로 생성 할 수 있도록 배열에 직접 $ _POST를 할당해야합니다. 그런 다음 배열을 반복하고 비어 있지 않은 키의 값만 인쇄하십시오.

+0

'$ _POST'를 통해 루프가 아닌 다른 배열에'$ _POST '를 할당하는 이유는 무엇입니까? – geomagas

+0

@geomagas 불필요한 POST 변수가있을 수 있습니다. – h2ooooooo

+0

그래서 $ _POST를 배열 _에 직접 할당하면 안됩니다. 맞습니까? – geomagas

3

당신은 단순히뿐만 아니라 빈 값을 표시에 $_POST을 반복 할 수 (나는 또한 만들 수있는 체크를 추가 한 $_POST해야 당신이 다른 POST 값을 가질 경우에 대비, servicio 시작 있는지 확인). 우리의 문자열이 비어 있지 않은지 확인하고 - (그들은 우리가 바로 그것을 출력하는 대신 변수에 모두 넣을 수 있는지 확인 ob_start, ob_get_clean) 및 !empty()

는 여기에서 우리는 출력 버퍼의 혼합을 사용합니다. 당신이 (From: $emailNovia에 사용하기 위해) 코드에있는 $emailNovia을 정의하지 않은

<?php 
    // ******* PROCESS EMAILS 
    $emailSubject = 'Solicitud de Servicio ERASE - '.$_POST['nombreNovia']; 
    $webMaster = '@.com'; 

    ob_start(); 

    ?> 
     <body style="font-size: 14px; font-family: sans-serif; margin: 0px; padding: 0px; color: #4D4D4D; background-color: #FAFAFA; -moz-box-sizing:border-box; box-sizing:border-box;"> 
      <div style="width: 100%; padding-left: 24px; padding-top: 24px; padding-bottom: 24px; background-color: #4D4D4D; -moz-box-sizing:border-box; box-sizing:border-box;"> 
       <img src="http://www.erase.com.mx/erase/email/img/logoEmail.png" alt="Logo ERASE"> 
      </div> 
      <div style="padding: 0px 24px; -moz-box-sizing:border-box; box-sizing:border-box;"> 
       <h1 style="text-align: center; font-size: 2.4em; line-height: 5em; font-weight: bold;">Solicitud de Servicio</h1> 

       <div style="width: 100%; text-align: left; margin-bottom: 48px; -moz-box-sizing:border-box; box-sizing:border-box;"> 
        <h2 style="text-align: left; font-size: 1.3em; width: 100%; margin-bottom: 20px;">INFO. DE LA NOVIA</h2> 
        <div style="width: 100%; text-align: left; margin-bottom: 48px; -moz-box-sizing:border-box; box-sizing:border-box;"> 

         <h2 style="text-align: left; font-size: 1.3em; width: 100%; margin-bottom: 20px;">SERVICIOS A MANEJAR</h2> 
         <p style="margin-left: 12px;"> 
          <?php 
           foreach ($_POST as $key => $value) { 
            if (strtolower(substr($key, 0, 8)) == 'servicio' && !empty($value)) { 
             ?> 
              <span class="answer" style="margin-left: 6px; line-height: 1.4em;"><?php echo $value; ?></span><br/><br/> 
             <?php 
            } 
           } 
          ?> 
         </p> 
        </div> 
       </div> 
      </div> 
     </body> 
    <?php 

    $body = ob_get_clean(); 

    $headers = "From: $emailNovia\r\n"; 
    $headers .= "Content-type: text/html\r\n"; 
    $success = mail($webMaster, $emailSubject, $body, $headers); 


    // ******* PROCESS EMAILS 
    //$message = "Gracias por contactarnos. Nos pondremos en contacto con usted cuanto antes<br />Atte:<br />(Lic. Cristina Madrid)"; 
    //$subject = "¡Gracias por escribirnos!"; 

    //$headers2 = "From: $webmaster\r\n"; 
    //$headers2 .= "Content-type: text/html\r\n"; 
    //mail($leademail, $subject, $message, $headers2); 


    // ******* REDIRECTION 
    header('Location: http://www.---.html') 
?> 

참고. 또한이 값 ($emailNovia)을 사용자가 으로 설정해야 안전한 지 확인해야합니다. 그렇지 않으면 누군가가 무리한 메일을 보내고 서버를 사용하여 원하는 모든 사람에게 스팸을 보낼 수 있습니다.

$services = array(
    $_POST['servicioBanquete'], 
    $_POST['ServicioDecoracion'], 
    $_POST['ServicioPirotecnia'], 
    $_POST['servicioBebidas'], 
    ... 
); 

그런 다음 동적으로 테이블을 생성 :

+0

잘 했어! @ h2ooooooo –

+0

알아요, 실제로 코드가 너무 길어서 코드를 더 짧게 붙여 넣으십시오. – Kunoxs

+0

이제 작동하지만 더 이상 코드가 작동하지 않아 전체 코드를 붙여 넣습니다. 원래 메시지에 – Kunoxs

1

먼저 당신은 배열을 사용할 필요가

<?php foreach($services as $service) : ?> 
    <?php if(!empty($service)) : ?> 
     <span class="answer" style="margin-left: 6px; line-height: 1.4em;">$servicioBanquete</span><br/><br/> 
    <?php endif; ?> 
<?php endforeach; ?> 
1

이에서 체크 박스의 입력을 변경하는 것이 좋습니다 :

<input type='checkbox' name='servicioBanquete'> 
<input type='checkbox' name='servicioDecoracion'> 
<input type='checkbox' name='servicioPirotecnia'> 

을 ... 이에 따라 :

<input type='checkbox' name='servicio[Banquete]'> 
<input type='checkbox' name='servicio[Decoracion]'> 
<input type='checkbox' name='servicio[Pirotecnia]'> 

이렇게하면 양식을 게시 할 때 $_POST['servicio'] 배열이 제공됩니다. 또한 검사 된 값만 포함하는 연관 배열이므로 아무런 검사도 필요하지 않습니다. empty()

개념 증명에 대한

는,이 시도 :

<!DOCTYPE html> 
<html> 
    <head> 
    <title>Checkboxes Array</title> 
    </head> 
    <body> 
    <pre><?php print_r($_POST); ?></pre> 
    <form method='post'> 
     <p><input type='checkbox' name='servicio[Banquete]'>Banquete</p> 
     <p><input type='checkbox' name='servicio[Decoracion]'>Decoracion</p> 
     <p><input type='checkbox' name='servicio[Pirotecnia]'>Pirotecnia</p> 
     <p><input type='submit' value='Go'></p> 
    </form> 
    </body> 
</html> 
관련 문제