mardi 11 février 2020

Submit and validate form commas [closed]

I'm trying to correct the code first, sending the form on post to check this fields, but i have a error on the code, there is any type of making this easy? Like one line code or other languages?

if ($_SERVER["REQUEST_METHOD"] == "POST") {

if (empty($_POST["nome"])) {
    $mensagens = "Nome is required";
  } else {
    $nome = test_input($_POST["nome"]);
  }

  if (empty($_POST["email"])) {
    $mensagens = "Email is required";
  } else {
    $email = test_input($_POST["email"]);
  }

  if (empty($_POST["logotipo"])) {
    $mensagens = "O logotipo é necessário.";
  } else {
    $logotipo = test_input($_POST["logotipo"]);
  }
}

if( isset($_POST['logotipo']) )
{
     echo $result;
     $mensagens = "Enviado.";
}

I think I need to learn more about pHp, but thats the error code that I have now.

Aucun commentaire:

Enregistrer un commentaire