Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. <div class="large-2 columns">
  2. <label>Nota<br>
  3. <input required="" type="radio" value="1" name="14_pesquisa">1
  4. <input required="" type="radio" value="2" name="14_pesquisa">2
  5. <input required="" type="radio" value="3" name="14_pesquisa">3
  6. <input required="" type="radio" value="4" name="14_pesquisa">4
  7. <input required="" type="radio" value="5" name="14_pesquisa">5
  8. <input required="" type="radio" value="6" name="14_pesquisa">6
  9. <input required="" type="radio" value="7" name="14_pesquisa">7
  10. <input required="" type="radio" value="8" name="14_pesquisa">8
  11. <input required="" type="radio" value="9" name="14_pesquisa">9
  12. <input required="" type="radio" value="10" name="14_pesquisa">10
  13. </label>
  14. </div>
  15.  
  16. if(($pesquisa14 >= 9 and $pesquisa1 != 0)) {
  17.  
  18. ok.....
  19.  
  20. else{
  21.  
  22. $retorno = "<SCRIPT LANGUAGE='JavaScript' TYPE='text/javascript'>
  23. alert('Algo deu errado. Tente novamente');
  24. history.back();
  25. </SCRIPT>";
  26.  
  27. echo $retorno;
  28.  
  29. }
  30.  
  31. <?php
  32. if (!empty($_POST)) {
  33. echo $_POST['texto'];
  34. }
  35. ?>
  36.  
  37. <html>
  38. <head>
  39. <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  40. </head>
  41.  
  42. <body>
  43. <form id="ajax_form">
  44. <p>Texto:</p>
  45. <p><textarea name="texto" rows="10" cols="30" placeholder="Descreva um comentario" /></textarea></p>
  46. <p><input type="submit" name="enviar"/></p>
  47. </form>
  48. <hr><p>Ajax:</p>
  49. <textarea id="log" rows="20" cols="70"></textarea>
  50. </body>
  51.  
  52. <script>
  53. $(document).ready(function(){
  54. $('#ajax_form').submit(function(){
  55. var dados = $(this).serialize();
  56. $.ajax({
  57. type: "POST",
  58. url: "post.php",
  59. data: dados,
  60. success: function(testlog) {
  61. $('textarea#log').text(testlog);
  62. }
  63. });
  64. return false;
  65. });
  66. });
  67. </script>
  68.  
  69. </html>
  70.  
  71. //javascript
  72.  
  73. function checaPesquisa() {
  74. sel = document.getElementByName("14_pesquisa").checked;
  75. if(!sel ){
  76. alert("Escolha uma opção");
  77. return false;
  78. }else{
  79. return true;
  80. }
  81. }
  82.  
  83. onClick = "return checaPesquisa()"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement