0
Every time I click to submit the form gives this error! How can I resolve this?
HTML 5 Form Code :
<form class = "col s12 m4 offset-m4 l4 offset-l4" action="submit_form.php" method="post">
<div class="row">
<div class="input-field col s12">
<i class="material-icons prefix sKtq-scColor"></i>
<input id="icon_prefix" name="Nome" type="text" class="validate sKtq-scColor" required>
<label for="icon_prefix" class = "sKtq-scColor">Nome</label>
</div>
<div class="input-field col s12">
<i class="material-icons prefix sKtq-scColor"></i>
<input id="icon_prefix" name="Email" type="email" class="validate sKtq-scColor" required>
<label for="icon_prefix" class = "sKtq-scCo lor">Email</label>
</div>
<div class="input-field col s12">
<i class="material-icons prefix sKtq-scColor">sort</i>
<input id="icon_prefix" name="Assunto" type="text" class="validate sKtq-scColor" required>
<label for="icon_prefix" class = "sKtq-scColor">Assunto</label>
</div>
<div class="input-field col s12">
<i class="material-icons prefix sKtq-scColor">chat_bubble</i>
<textarea id="textarea1" name="Mensagem" class="materialize-textarea validate sKtq-scColor" required></textarea>
<label for="textarea1" class = "sKtq-scColor">Mensagem</label>
</div>
</div>
<br>
<div class = "center-align">
<button class="btn waves-effect waves-light sKtq-bgScColor" type="submit"> Enviar
<i class="material-icons right">send</i>
</button>
</div>
</form>
PHP code that is in the file submit_form.php
:
<?php
if(isset($_POST['email'])) {
$email_to = "mtqr1@hotmailcom";
$email_subject = "Mensagem do site";
$name = $_POST['Nome']; // required
$email_from = $_POST['Email']; // required
$subject = $_POST['Assunto']; // required
$message = $_POST['Mensagem']; // required
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message = "Form details below.\n\n";
$email_message .= "Name : ".clean_string($name)."\n";
$email_message .= "Email : ".clean_string($email_from)."\n";
$email_message .= "Assunto : ".clean_string($subject)."\n";
$email_message .= "Mensagem : ".clean_string($message)."\n";
// create email headers
$headers = 'From: '.$email_from."\r\n".
'Reply-To: '.$email_from."\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email_to, $email_subject, $email_message, $headers);
?>
<!-- include your own success html here -->
<div class="feedback">Thank you for contacting us. We will be in touch with you very soon.</div>
<?php
}
?>
Error image
Are you using Github pages? If yes it does not allow you to run a script on the server side. Which begs the question: how did you manage to put?
– Juven_v
So I’m using Git Hub Pages and I haven’t found it anywhere in the documentation saying it doesn’t allow it I just left this script. php at the root of my project ! You know what’s wrong with this script ?
– Matheus Tadeu