0

I use wordpress for my website. Then i created a form which send e-mail that contains critics and suggestion. The message is sent but i can't get the critics/suggestion value from input.

<?php    
$myemail = '';//<-----Put Your email address here.
$email = $_POST['email'];
$comment = $_POST['message'];

if(isset($_REQUEST['submit']))
{
$to = $myemail;
$email_body = "Ada kritik dan saran dari seseorang!.\n".
"Pengirim: $email \n".
"Pesan:\n $comment";
mail($to,"Kritik dan Saran",$email_body);}

add_filter ('the_content', 'guerrilla_add_post_content', 0);
function guerrilla_add_post_content($content) {
    if (is_single()) { 
        $content .= '
            <div class="guerrillawrap">
  <h5 style="
    margin-bottom: 20px;
    margin-top: 0;
">Bantu tingkatkan kualitas review dan artikel TerasGame dengan mengirimkan Kritik &amp; Saran</h5>
  <form method="POST" action="" name="contact_form" enctype="text/plain">
<input type="text" name="email" style="
    width: 29%;
" placeholder="E-mail Kamu" value=""><input type="text" name="message" value="" style="
    width: 70%;
    /* text-align: center; */
    float: right;
" placeholder="Tulis Kritik dan Saranmu di sini..."> 
<input type="submit" name="submit" style="
    width: 100%;
    margin-top: 10px;
    text-align: center;
    float: right;
">

  </form>
<p></p></div>
        ';
    }
    return $content;
}

?>

I've tried a lot of ways, and I've sent a lot of emails from the form, but they are same, no message and email input value. Thanks.

Kevin Stich
  • 773
  • 1
  • 8
  • 24
Sena
  • 178
  • 1
  • 13

2 Answers2

1

Remove enctype="text/plain" so it's just

<form method="POST" action="" name="contact_form">

You used the one encoding type that won't work. For details see: http://www.w3schools.com/tags/att_form_enctype.asp

toster-cx
  • 2,287
  • 1
  • 26
  • 32
1

Remove enctype="text/plain.and also create your html code correct format.

<body>

        <div class="guerrillawrap">
            <h5 style="margin-bottom: 20px;margin-top: 0;">Bantu tingkatkan kualitas review dan artikel TerasGame dengan mengirimkan Kritik &amp; Saran</h5>
            <form method="POST" action="example.php" name="contact_form">
                <input type="text" name="email" style="width: 29%;" placeholder="E-mail Kamu">
                <input type="text" name="message" style="width: 70%;float: right;" placeholder="Tulis Kritik dan Saranmu di sini..."> 
                <input type="submit" name="submit" style="width: 100%;margin-top: 10px;text-align: center;float: right;">

            </form>
            <p></p></div>

    </body>
Optimaz Prime
  • 857
  • 10
  • 11