Advertisement
Guest User

Untitled

a guest
Sep 17th, 2015
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. /* HTML */
  2. <?php
  3. $msg=0;
  4. $msg= $_REQUEST['msg'];
  5. ?>
  6.  
  7. <!DOCTYPE html>
  8. <html>
  9. <head>
  10. <title></title>
  11. </head>
  12. <body>
  13. <?php if($msg=="enviado"): ?>
  14. <h1>Mensagem enviada </h1>
  15. <?php else: ?>
  16. <form action="processform.php" method="post">
  17. <center>
  18. <fieldset>
  19. <legend>Informacoes Principais</legend>
  20. <label for="nome_id">Nome: </label>
  21. <input type="text" placeholder="Marcello" name="nome" id="nome_id" required>
  22. </br>
  23. <label for="site_id">Site: </label>
  24. <input type="url" placeholder="google.com" name="site" id="site_id" required>
  25. </br>
  26. <label for="idade_id">Idade: </label>
  27. <input type="number" min="12" max="60" step="2" name="idade" id="idade_id" required>
  28. </br>
  29. <label for="e-mail_id">Email: </label>
  30. <input type="email" placeholder="prd@gmail.com" name="e-mail" id="e-mail_id" required>
  31. </br>
  32. <label for="numero_id">Numero: </label>
  33. <input type="text" pattern="[(]{1}[0-9]{2}[)]{1}[0-9]{5}[-]{1}[0-9]{4}" title="(00)91234-5678" placeholder="(31)99954-3342" id="numero_id" required>
  34. </br>
  35. <label for="key_id">Chave: </label>
  36. <input type="number" value="73" readonly id="key_id">
  37. </br>
  38. <label for="vouche_id">Vouche: </label>
  39. <input type="number" value="128859" id="vouche_id" disabled>
  40. </fieldset>
  41. <fieldset>
  42. <legend>Informacoes Opcionais</legend>
  43. <fieldset>
  44. <legend>Nacionalidade</legend>
  45. <input id="br_id" name="nacionality" type="checkbox" value="Brasil"> Brasil
  46. <input id="al_id" name="nacionality" type="checkbox" value="Alemanha"> Alemanha
  47. <input id="hu_id" name="nacionality" type="checkbox" value="Hungria" checked> Hungria
  48. </fieldset>
  49. <fieldset>
  50. <legend>Sexo</legend>
  51. <input id="Ma_id" name="sexo" type="radio" value="Masculino" checked> Masculino
  52. <br>
  53. <input id="Fe_id" name="sexo" type="radio" value="Feminino"> Feminino
  54. </fieldset>
  55. <fieldset>
  56. <legend>Cor Preferida</legend>
  57. <input id="Pr_id" name="cor" type="radio" value="Preta" checked> Preta
  58. <br>
  59. <input id="Br_id" name="cor" type="radio" value="Branca"> Branca
  60. </fieldset>
  61. </br>
  62. <datalist id="comidas_id">
  63. <option value="Lasanha">
  64. <option value="Lambo">
  65. <option value="Lampada">
  66. <option value="Amparina">
  67. </datalist>
  68. <label for="comida_id">Comida: </label>
  69. <input id = "comida_id" name = "comida" type = "text" list = "comidas_id">
  70.  
  71. </fieldset>
  72. <br>
  73. <select id = "estados_id" name = "estado" multiple = "multiple">
  74. <optgroup label = "Regiao Sudeste">
  75. <option value = "SP"> Sao Paulo </option>
  76. <option value = "RJ"> Rio de Janeiro </option>
  77. <option value = "RS"> Rio Grande do Sul </option>
  78. </optgroup>
  79. <optgroup label = "Regiao Nordeste ">
  80. <option value = "PR"> Parana </option>
  81. <option value = "RN"> Rio Grande do Norte </option>
  82. <option value = "BA"> Bahia </option>
  83. </optgroup>
  84. </select >
  85. </br> </br>
  86. <input id="botao_sub" type="submit" value="enviar">
  87. <input id="botao_res" type="reset" value="resetar">
  88. </center>
  89. </form>
  90. <?php endif; ?>
  91. </body>
  92. </html>
  93.  
  94. /* PHP */
  95.  
  96. <?php
  97. $nome = $_POST['nome'];
  98. $site = $_POST['site'];
  99. $idade = $_POST['idade'];
  100. $email = $_REQUEST['e-mail']; // REQUEST recebe tanto via GET quanto POST
  101.  
  102. echo "Bem vindo $nome seus dados:".</br>;
  103. echo "$site $idade $email".</br>;
  104.  
  105. $dest = "prodmarcello@gmail.com";
  106. $assu = "Formulario";
  107. $corp = "My message $idade";
  108. $head = "Content-type: text/html; charset= utf-8\n";
  109. $head .= "From: $dest Reply-to: $email";
  110.  
  111. mail($dest, $assu, $corp, $head);
  112. header("location:form.html?msg=enviado");
  113. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement