php问题

2
@Ta 2013-03-15 2239点击
<?php
$post = $_POST['reply'];
$file=fopen('reply.txt','w+');
fwrite($file,$post,'9999');
fclose($file);
if($_POST['submit']){
echo '修改完成!';
}else{
echo '修改回复内容:<br><form name="input" action="xg.php" method="post">
<input type="text" name="reply">
<input type="submit"  name="submit" value="修改"></from>';
}
?>

就是一个填写保存reply.txt文件的页面,无效,求解,麻烦各位了~
回复列表(6|隐藏机器人聊天)
  • @Ta / 2013-03-13 / /
    <input type="button"/>改成<input type="submit">
  • @Ta / 2013-03-13 / /
    没有name="submit"的输入框,所以你的那个if($_POST['submit'])判断永远无效,
  • @Ta / 2013-03-13 / /
    这是修改后的    <?php if($_POST["submit"])  {   $post = $_POST['reply'];   #这里的句柄打开方式,我把w改成了a+   $file=fopen('reply.txt','a+');   fwrite($file,$post);   fclose($file);   echo '修改完成!';  }else{   echo '修改回复内容:        <br>        <form action="?" method="post">        <input type="text" name="reply"/><br />        <input type="submit" name="submit" value="修改"/>        </from>';  } ?> 
  • @Ta / 2013-03-13 / /
      <?php if($_POST["submit"])  {   $post = $_POST['reply'];   #这里的句柄打开方式,我把w改成了a+   $file=fopen('reply.txt','a+');   fwrite($file,$post);   fclose($file);   echo '修改完成!';  }else{   echo '修改回复内容:        <br>        <form action="?" method="post">        <input type="text" name="reply"/><br />        <input type="submit" name="submit" value="修改"/>        </from>';  } ?> 
  • @Ta / 2013-03-13 / /
    晕,换行全没了,,
  • @Ta / 2013-03-13 / /
    @齐子,第二行的w后面有个空格,去掉。我知道你是想xiew+的,可是变w 了。只写w也是可以的。以后不要再用uc编辑代码了,包括把+变空格在内,uc有诸多问题。
添加新回复
回复需要登录