WordPress.org

Ready to get started?Download WordPress

Forums

Error when creating a form with PlugIn Sniplets (1 post)

  1. ruimacdonald
    Member
    Posted 4 years ago #

    I have created the following code in a Sniplet, but it foesn't work, Can you help please.
    Regards
    Rui
    ««««««««««««««««««««««««
    <?php
    function mostrar_formulario()
    {
    global $PHP_SELF;
    ?>

    <form action="<?php echo $PHP_SELF; ?>" method=POST>
    Nome: <input type=text name="nome">
    Email: <input type=text name="email">

    <input type=submit value="Submeter Dados">
    </form>

    <?php
    }
    ?>

    <?php
    function processa_formulario() {
    global $nome;
    global $email;
    printf("O Nome %s tem como email %s .", $_POST['nome'], $_POST['email']);
    }
    ?>
    <?php
    if (empty($_POST['nome'])) {
    mostrar_formulario();
    }
    else
    {
    processa_formulario();
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags