哪里有问题?然后我在我的/ localhost上打开.PHP显示消息“解析错误:语法错误,意外T_STRING in ...” 也许代码不正确?
<?php
if($_POST) {
$name = $_POST['news_name'];
$content = $_POST['news_text'];
$handle = fopen ("z_padomi_ka_atmest_smekesanu.php","a");
fwrite($handle,"<b>".$name."</b>:<br/>".$content."<br/>
fclose($handle);
}
?>
<script type="text/javascript">
document.getElementById('com-form').action = "z_padomi_ka_atmest_smekesanu.php";
</script>
<form action = "" method="post">
<p class="left"><label for="news_name"><b>Vārds:</b></label><br/><input type="text" name="news_name" id="news_name" value="" size="15" class="input big8"></p>
<p class="even"><label for="news_text"><b>Pievienot atbildi:</b></label><br/><textarea name="news_text" id="news_text" cols="75" rows="3" wrap="virtual"></textarea></p>
</p><p class="buttons right"><input id="add" type="submit" value="Pievienot" class="submit"><br>
<li><a style="text-decoration: underline; padding-right:10px; padding-top:5px" href="pamaciba.html" target="_blank">Komentāru noteikumi</a></p>
</form>
<?php include "z_padomi_ka_atmest_smekesanu.php";
</script>
答案 0 :(得分:2)
你忘了关闭一个字符串。
更改此
fwrite($handle,"<b>".$name."</b>:<br/>".$content."<br/>
fclose($handle);
到此
fwrite($handle,"<b>".$name."</b>:<br/>".$content."<br/>");
fclose($handle);
修改强>
你也忘记了一个php关闭标签:
<?php include "z_padomi_ka_atmest_smekesanu.php";
</script>
要
<?php include "z_padomi_ka_atmest_smekesanu.php"; ?>
</script>