How to submit form in the simplest way possible? [closed]

-4

I have a simple form with name, email and message. I would like to send the result of this form to two e-mail addresses. Does anyone outline some simple way with PHP for me to submit this form?

Can not send only with javascript, right?

Note: I have edited the question to be clearer.

    
asked by anonymous 16.12.2015 / 00:26

2 answers

5

I do not know if it's the simplest way, but just sending this information to another page (.php) can be as simple as that:

. index.html

<form action="saida.php" method="post">
    <input type="text" name="nome"> // o name é usado para resgatar no PHP
    <input type="text" name="email">
    <textarea rows="4" cols="50" name="mensagem"></textarea>
    <input type="submit" value="Enviar">
</form>

. saida.php

if (isset($_POST)) { // o isset verifica se o formulário foi enviado
    $nome = $_POST['nome'];
    $email = $_POST['email'];
    $mensagem = $_POST['mensagem'];
    echo "Nome: " . $nome . "<br>";
    echo "Email: " . $email . "<br>";
    echo "Mensagem: " . $mensagem . "<br>";
}
else {
   echo "Falhou.";
}

This is a very simple example, without any kind of validation and sanitization of the data, and if you want to send the result to an email, file or database are already another five hundred.

To submit on the same page, see this question.

    
16.12.2015 / 02:31
2

Server Side would be a PHP for example, usually it is not the one that sends the form but who handles the information.

In HTML you make a form with the tags action="suapagina.php" and method="post ou get"

This way within the php vc you access these values through the variables $GET['nomecampo'] and $POST['nomecampo'] , depending on which method to use.

Here's a little bit about this: link

    
16.12.2015 / 01:20