Calling PHP file in HMTL form

Asked

Viewed 1,847 times

0

I want to call a. PHP file, but I can’t.

I have this script:

========

    <html>
<header>
    <title>Home Page</title>
</header>
<body>
<form method="post">
    <fieldset>
        <legend>O que deseja fazer?</legend>
        <table cellspacing="10">
            <tr>
                <td>
                    <input type="submit" value="Cadastrar" onclick="javascript: location.href='pagina.php';" />
                </td>
            </tr>
        </table>
    </fieldset>
</form>
</body>
</html>

=========

This script doesn’t work. What I do wrong?

Grateful for the help.

3 answers

1


It depends, if you just want to redirect to the page at the moment of the click, you must create the tag for link if not, the act is the registration and you want to send data to work with them in PHP, the option of rafael August is valid. Link tag:

<a href="pagina.php">Cadastrar</a>
  • OK. Thank you very much!

  • For nothing, I hope to have helped you. Hugs

0

Put in form one action="pagina.php"

Example <form method="post" action="teste.php"></form>

  • Thanks for the answer. But, if you allow, I would have some way to do this, without using the form ACTION, but using the button ONCLICK?

0

Desejo chamar um arquivo .PHP, porém não consigo.

Possuo esse script:

========

    <html>
<header>
    <title>Home Page</title>
</header>
<body>
<form method="post" action="pagina.php">
    <fieldset>
        <legend>O que deseja fazer?</legend>
        <table cellspacing="10">
            <tr>
                <td>
                    <input type="submit" value="Cadastrar"/>
                </td>
            </tr>
        </table>
    </fieldset>
</form>
</body>
</html>

<form action="pagina.php" method="POST">
    <input type="text" name="nome">
    
    <input type="submit" value="Ir para Pagina">
 </form>

Just use the :D action

  • Thanks for the answer. But, if you allow, I would have some way to do this, without using the form ACTION, but using the button ONCLICK?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.