Ca - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of Ca.php

  1. <html>
  2. <head>
  3. <title>Cadastro</title>
  4. <!-- É aqui que o javascript controlará a digitação de campos obrigatórios -->
  5. <script language="javascript">
  6. <!-- chama a função (nomeform) -->
  7. function valida_dados (nomeform)
  8. {
  9.     if (nomeform.nome.value=="")
  10.     {
  11.         alert ("Por favor digite o nome.");
  12.         return false;
  13.     }
  14.  
  15.     if (nomeform.login.value=="")
  16.     {
  17.         alert ("Por favor digite o login.");
  18.         return false;
  19.     }
  20.  
  21.    
  22. }
  23. </script>
  24.  
  25.  
  26. </head>
  27. <body>
  28. <h3 align="center">Cadastro de Colaborador</h3>
  29.  
  30. <!-- aqui começa o formulario -->
  31.  
  32. <form method="POST" action="colaborador.php" onSubmit="return valida_dados(this)">
  33. <table border="0" align="center">
  34. <tr><td><b>Dados Pessoais</b></td></tr>
  35. <tr><td></td></tr>
  36.   <tr><td align="right">Nome: </td><td><input type="text" name="nome" size="20"></td>
  37.  
  38. <tr><td align="right">Login: </td><td><input type="text" name="login" size="20"></td>
  39.  
  40. <tr><td></td></tr>
  41.  
  42.  
  43. </tr>
  44.  
  45. </table><br><br>
  46. <table align="center">
  47.   <tr><td align="center"><input type="submit" value="Enviar" name="enviar"></td>
  48. <td align="center"><input type="reset" value="Limpar" name="enviar"></td></tr>
  49. </table>
  50. </form>
  51. </body>
  52. </html>
File Description
  • Ca
  • PHP Code
  • 09 Feb-2021
  • 1.2 Kb
You can Share it: