Comunidad de diseño web y desarrollo en internet online

poner mas opciones en este formulario???? se puede??

Citar            
MensajeEscrito el 04 Nov 2009 06:35 pm
buenas tengo este formulario con su recpectivo php, y quisiera poder poner mas opciones entre ellos un menu desplegable, y casilas para marcar, nada del otro mundo vamos, yo lo que tengo es solo, esto que tiene nombre, email asunto y comentario, y quiero incresar mas opciones como lo hago, dejo el html y el php gracias

Código HTML :

<form name="phpformmailer" action="http://www.alfonsobotello.com./formulario.php" align="center" method="post">
  <div align="center"><center><table bgcolor="#F2F2F2" width="528" cellspacing="6">
    <tr>
      <td width="499" colspan=2><span class="Estilo1">Formulario de Contacto :</span></td>
    </tr>
    <tr>
      <td align="right" width="159"><small>Nombre y Apellido:</small></td>
      <td width="349"><font face="Arial"><input class="inputc" size="29" name="name"></font></td>
    </tr>
    <tr>
      <td align="right" width="159"><font color="#000080" size="1">*</font><small> Email:</small></td>
      <td align="left" width="349"><font face="Arial"><input class="inputc" size="29"
      name="email"></font></td>
    </tr>
    <tr align="middle">
      <td align="right" width="159"><font color="#000080" size="1">*</font><small> Confirmar Email:</small></td>
      <td width="349" align="left"><font face="Arial"><input class="inputc" size="29"
      name="email2"></font></td>
    </tr>
    
    <tr>
      <td align="right" width="159"><font color="#000080" size="1">*</font><small> Asunto:</small></td>
      <td width="349"><font face="Arial"><input class="inputc" size="29" name="thesubject"></font></td>
    </tr>
    <tr>
      <td align="right" width="159">&nbsp;<p><font color="#000080" size="1">*</font><small> Mensaje:</small></td>
      <td width="349"><textarea style="FONT-SIZE: 10pt" name="themessage" rows="7" cols="27"></textarea></td>
    </tr>
    <tr>
      <td width="159"></td>
      <td width="349"><p>
        <script language="JavaScript"><!--
function validateForm() 
{
 var okSoFar=true
 with (document.phpformmailer)
 {
  var foundAt = email.value.indexOf("@",0)
  if (foundAt < 1 && okSoFar)
  {
    okSoFar = false
    alert ("Ingrese un Email Valido.")
    email.focus()
  }
  var e1 = email.value
  var e2 = email2.value
  if (!(e1==e2) && okSoFar)
  {
    okSoFar = false
    alert ("El Email ingresado no es igual a la confirmacion. Ingrese el mismo nuevamente.")
    email.focus()
  }
  if (thesubject.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Ingrese el Asunto.")
    thesubject.focus()
  }
  if (themessage.value=="" && okSoFar)
  {
    okSoFar=false
    alert("Ingrese el mensaje.")
    themessage.focus()
  }
  if (okSoFar==true)  submit();
 }
}
// --></script>
        <input type="button" class="button"
      value="Enviar" name="B1" ONCLICK="javascript:validateForm()">
        <label></label>
        <small><small>Debe llenar los campos marcados con *</small></small> </p>
        </td>
    </tr>
  </table>
  </center></div>
</form>


Código PHP :

<?php

// ------- aqui lo configuro  -------------------------------------------------------
$valid_ref1="http://www.xxxxxxxxxxx.com./base.html";// dominio
$valid_ref2="http://www.xxxxxxxxxxx.com./base.html";// dominio
$replyemail="[email protected]";//email
// ------------------------------------------------------------

//clean input in case of header injection attempts!
function clean_input_4email($value, $check_all_patterns = true)
{
 $patterns[0] = '/content-type:/';
 $patterns[1] = '/to:/';
 $patterns[2] = '/cc:/';
 $patterns[3] = '/bcc:/';
 if ($check_all_patterns)
 {
  $patterns[4] = '/\r/';
  $patterns[5] = '/\n/';
  $patterns[6] = '/%0a/';
  $patterns[7] = '/%0d/';
 }
 //NOTE: can use str_ireplace as this is case insensitive but only available on PHP version 5.0.
 return preg_replace($patterns, "", strtolower($value));
}


$name = clean_input_4email($_POST["name"]);
$email = clean_input_4email($_POST["email"]);
$thesubject = clean_input_4email($_POST["thesubject"]);
$themessage = clean_input_4email($_POST["themessage"], false);

$error_msg='ERROR - no enviado. Intente nuevamente.';

$success_sent_msg='<p align="center"><strong>&nbsp;</strong></p>
                   <p align="center"><strong>Su mensaje ha sido enviado<br>
                   </strong> y contestaremos a la brevedad posible.</p>
                   <p align="center">Ademas le hemos enviado una copia de su pedido.</p>
                   <p align="center">Gracias por contactarse.</p>';

$replymessage = "Hola $name

Gracias por su mensaje.

Contactaremos con usted a la brevedad posible, muchas gracias

Por favor no responda a este correo.

Su Email: $email
--------------------------------------------------
Asunto: $thesubject

Mensaje:

$themessage
--------------------------------------------------

Gracias";

// email variable not set - load $valid_ref1 page
if (!isset($_POST['email']))
{
 echo "<script language=\"JavaScript\"><!--\n ";
 echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
 exit;
}

$ref_page=$_SERVER["HTTP_REFERER"];
$valid_referrer=0;
if($ref_page==$valid_ref1) $valid_referrer=1;
elseif($ref_page==$valid_ref2) $valid_referrer=1;
if(!$valid_referrer)
{
 echo "<script language=\"JavaScript\"><!--\n alert(\"$error_msg\");\n";
 echo "top.location.href = \"$valid_ref1\"; \n// --></script>";
 exit;
}
$themessage = "Nombre: $name \nMensaje: $themessage";
mail("$replyemail",
     "$thesubject",
     "$themessage",
     "From: $email\nReply-To: $email");
mail("$email",
     "$thesubject",
     "$replymessage",
     "From: $replyemail\nReply-To: $replyemail");
echo $success_sent_msg;
?> 

Por alfonso55

11 de clabLevel



 

firefox
Citar            
MensajeEscrito el 05 Nov 2009 08:28 pm
cuando pones <INPUT TYPE""> en type tienes esas opciones que dices de combobox y radiobuttons

Por kreativodesigns

15 de clabLevel



 

firefox
Citar            
MensajeEscrito el 06 Nov 2009 06:15 pm
hmmm, mira :S, si lo que quieres es agregar mas campos a rellenar, solo duplica y revalida, con eso y listo... cualquier cosa me dices...

Por smokingwel

16 de clabLevel



 

msie

 

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