doutuo7815 2013-01-01 15:04
浏览 11
已采纳

PHP $ _POST为空[重复]

Possible Duplicate:
method=“post” enctype=“text/plain” are not compatible?

I know this topic was few times on this forum, but none of this solved my problem.

When i try send "contact" data from html site, using method POST, on my php site im getting empty $_POST. I checked one hundert sites and tutorials. I did exacly same like it was showed... Using method "GET" im getting data, but i cant go this way. URL too long.

this is my HTML code.

<form  name="post" id="post" method="POST" action="http://podsmoczymdiamentem.host56.com/post.php"  enctype="text/plain">
<table BORDER="0" CELLSPACING="0" CELLPADDING="4">
<tr><td colspan="2"><b>Tytuł:</B></TD></tr>
<tr><td colspan="2"><input type="text" name="tytul" id="tytul" size="30"></TD></TR>
<tr><td colspan="2"><b>Treść:</B></TD>
<tr> <td colspan="2"><textarea name="opowiadanie" cols="70" wrap="virtual" rows="30"></TEXTAREA></TD></TR>
<tr><td align="right"></TD><td align="right"><b>Imię:</B><input type="text" name="autor" size="20"></TD></TR>
<tr><td></TD><td align="right"><b>e-mail:</B><input type="text" name="e-mail" size="20"></TD></TR>
<tr> <td>&nbsp;</TD> <td align="right">
<input type="submit" name="submit" value="Wyślij"><input type="reset" name="reset" value="Wyczyść">
</TD></TR>
</TABLE></FORM></div> 

and PHP

<?php
      if (empty($_POST['submit'])) {
        echo 'Wiadomość jest pusta!';
     }else{    
      $autor = $_POST['autor'];
      $tytul = $_POST['tytul'];
      $subject = "$autor nadesłał swoją opowieść: $tytul";
      $nadawca = $_POST['e-mail'];
      $adresat = 'podsmoczymdiamentem@gmail.com'; 
      $opowiadanie = $_POST['opowiadanie'];
      $headers .= "Content-Type: text/html; charset=ISO-8859-2
";
      $subject = "=?ISO-8859-2?B?".base64_encode($subject)."?=";
      $tresc = "Witaj Marcinie. Użytkownik <b>$autor</b> nadesłał opowiadanie do twej karczmy. Oto ono:<br><br><b><h1>$tytul</h1></b><br><br> $opowiadanie";
      $mail_sent = @mail( $adresat, $subject, $tresc, $headers);
      if($mail_sent == TRUE)
        echo 'Wiadomość została wysłana.';
      else
        echo 'Ups. Coś nie wyszło. Skontaktuj się z karczmarzem PSD w celu wyjaśnienia problemu.';
      }
?>

what im doing wrong?

  • 写回答

1条回答 默认 最新

  • duanchen1937 2013-01-01 15:08
    关注

    You are using the wrong encoding type. Use application/x-www-form-urlencoded instead of text/plain.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度