Feedback Form (self made) not working

Hi again!

I have (yet) a web page in Hostinger, and yesterday I “created” the same page in 000webhost, meaning I transfered the files index.html (includes code: form class=“form” method=“post” action=“contact.php”) + contact.php + kiitoksia.html (the page which user gets when submits the form) with FTP (made no changes to the original page)… and all went well, except my feedback form stopped working.

I changed contact.php R/W rights as 777, as well as .htaccess rights, but the form wont work. I wonder, is there in 000webhost a possibility to enable/disable php code? Meaning, why the same code works in Hostinger?

About “kiitoksia.html”, it’s the same as index.html (both UTF-8) but contains less info. In php file, tried to change this: header(“Location: ./*kiitoksia.html”)**; to this: header(“Location: kiitoksia.html”); , no effect.

If it helps, I give You the php code (your platform disables html-code at least in preview-window) and result after Submit (the example-myemail.com is a fake, don´t want to give my real email here =):

PHP:

<?

$your_email = "example@myemail.com";

$headers= "From: ".$_POST['name']." <".$_POST['email'].">\r\n";
$headers.='Content-type: text/html; charset=utf-8';
mail($your_email, $_POST['subject'],  "
    
<html>
    <head>
     <title>Yhteystiedot</title>
    </head>
    <body>
    	PALAUTE<br><br>
    	Nimi : ".$_POST['name']."<br>
    	Email : ".$_POST['email']."<br>
    	Puhelin : ".$_POST['telephone']."<br><br>
    	Aihe : ".$_POST['subject']."<br>
    	Viesti : <br>".$_POST['message']."<br>
    </body>
    </html>" , $headers);
header("Location: ./kiitoksia.html");
?>

**RESULT** AT SCREEN, NO MESSAGE DELIVERED/RECEIVED:

\r\n"; $headers.='Content-type: text/html; charset=utf-8'; mail($your_email, $_POST['subject'], " PALAUTE

Nimi : ".$_POST['name']."
Email : ".$_POST['email']."
Puhelin : ".$_POST['telephone']."

Aihe : ".$_POST['subject']."
Viesti :
".$_POST['message']."
" , $headers); header("Location: ./kiitoksia.html"); ?>
1 Like

Can you try this one instead?

<?

$your_email = "cwkhawand@gmail.com";

$headers= "From: ".$_POST['name']." <".$_POST['email'];
$headers .='Content-type: text/html; charset=utf-8';
mail($your_email, $_POST['subject'],  "
    
<html>
    <head>
     <title>Yhteystiedot</title>
    </head>
    <body>
    	PALAUTE<br><br>
    	Nimi : ".$_POST['name']."<br>
    	Email : ".$_POST['email']."<br>
    	Puhelin : ".$_POST['telephone']."<br><br>
    	Aihe : ".$_POST['subject']."<br>
    	Viesti : <br>".$_POST['message']."<br>
    </body>
    </html>" , $headers);
header("Location: ./kiitoksia.html");
?>

**RESULT** AT SCREEN, NO MESSAGE DELIVERED/RECEIVED:

$headers .='Content-type: text/html; charset=utf-8'; mail($your_email, $_POST['subject'], " PALAUTE

Nimi : ".$_POST['name']."
Email : ".$_POST['email']."
Puhelin : ".$_POST['telephone']."

Aihe : ".$_POST['subject']."
Viesti :
".$_POST['message']."
" , $headers);
header("Location: ./kiitoksia.html"); ?>

Yes, I changed the code (of course the receiver also), result after submit:

PALAUTE

Nimi : ".$_POST[‘name’]."
Email : ".$_POST[‘email’]."
Puhelin : “.$_POST[‘telephone’].”

Aihe : “.$_POST[‘subject’].“
Viesti :
”.$_POST[‘message’].”
" , $headers); header(“Location: ./kiitoksia.html”); ?>

…did not work, sorry. You tried this, I suppose: <".$_POST[‘email’].">\r\n"; to this <".$_POST[‘email’];

What about

<?

$your_email = "cwkhawand@gmail.com";

$headers= "From: ".$_POST['name']." <".$_POST['email'];
$headers .='Content-type: text/html; charset=utf-8';
mail($your_email, $_POST['subject'],  "
    
<html>
    <head>
     <title>Yhteystiedot</title>
    </head>
    <body>
    	PALAUTE<br><br>
    	Nimi : ".$_POST['name']."<br>
    	Email : ".$_POST['email']."<br>
    	Puhelin : ".$_POST['telephone']."<br><br>
    	Aihe : ".$_POST['subject']."<br>
    	Viesti : <br>".$_POST['message']."<br>
    </body>
    </html>" , $headers);
header("Location: ./kiitoksia.html");
?>

No, still not working. Sorry for the delay, empty cache went wrong…logged out from the forum =)

Could it help if i give you the addresses in both pages, Hostinger & 000 webhotel, in tinyurls?

Just in case, if anyone’s interested - I give up on that recent PHP and made it simpler (also dropped out phone number & subject, not needed in my form and instead of thank.html I “echoed” message when submitted)…this is simple, easy and it works:

<?php $name = $_POST['name']; $email = $_POST['email']; $message = $_POST['message']; $formcontent="Lähettäjä (Sender): $name \n Viesti (Message): $message"; $recipient = "myemail@email.com"; $subject = "XYZ"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Virhe (Error). Yritä uudestaan (Try again)!"); echo "Kiitos (Thanks etc....=)"; ?>

That’s all folks.

1 Like