teste - PHP Online
Form of PHP Sandbox
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
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.
Result of php executing
Full code of teste.php
- <script type="text/javascript">
- function validaCampo()
- {
- if(document.cadform.titulo.value=="")
- {
- alert("O Campo titulo é obrigatório!");
- return false;
- }
- else
- return true;
- }
- if(document.cadform.mome.value=="")
- {
- alert("O Campo nome é obrigatório!");
- return false;
- }
- else
- return true;
- }
- <!-- Fim do JavaScript que validará os campos obrigatórios! -->
- </script>
- depois eu vou criar o formulario assim
- <form id="cadform" name="cadform" method="post" action="enviar.php" onsubmit="return validaCampo();">
- <label for="titulo">Titulo</label>
- <input name="titulo" type="text" id="titulo" size="40" />
- <label for="nome">Nome</label>
- <input name="nome" type="text" id="nome" size="40" />
- <input type="submit" name="enviar" id="enviar" value="Submit" />
- </form>