日期:2014-05-17  浏览次数:20523 次

一个提交留言的模板提交后老是显示点击下载保存的页面
代码如下
html部分
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 "   enctype= "multipart/form-data ">
<title> input </title>

</head>

<body>
<form   action= "input.php "   method= "post "   >
    <p> 你的姓名:
        <input   name= "name "   type= "text "   value= " ">
</p>
    <p> 你的性别:  
        <input   type= "radio "   name= "sex "   value= "1 ">  
        男
        <label>
        <input   type= "radio "   name= "sex "   value= "0 ">  
        女
</label>
        <br>
    </p>
    <p> 你的email:
        <input   type= "text "   name= "email ">        
        </br>
    </p>
    <p> 你的留言内容:
        <textarea   name= "infor "   cols= "50 "   rows= "10 "> </textarea>
    </p>
    <p>
        <input   type= "submit "   name= "Submit "   value= "提交 ">
        <input   type= "reset "   name= "Submit2 "   value= "重置 ">
        <br>
    </p>
</form>
</body>
</html>
php部分的
<?
echo   $name. ' <p> ';
echo   $sex. ' <p> ';
echo   $email. ' <p> ';
echo   $infor. ' <p> ';


$mysql_server_name= "localhost ";
$mysql_username= "****** ";
$mysql_password= "****** ";
$mysql_database= "****** ";
$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password);
$sql= "INSERT   INTO   `leaoon`.`liuyan`   (`id`   ,`name`   ,`sex`   ,`email`   ,`infor`   ,`ip`   ,`time_at`   )VALUES   (NULL   ,   '$name ',   '$sex ',   '$email ',   '$infor ',     ' '); ";
$result=mysql_db_query($mysql_database,$sql,$conn);
$row=mysql_fetch_row($result);
print_r($row);
myaql_free_result($result);
?>



------解决方案--------------------
貌似php没配好。
<? echo phpinfo(); ?>
看出现什么。
------解决方案--------------------
十有八九是你的PHP沒有配置成功!
------解决方案--------------------
apache的配置文件少一句
AddType application/x-httpd-php .php
------解决方案--------------------
find / -name httpd.conf
查找一个这个文件

一般会在 /usr/local/ 底下的某个目录
for example /usr/local/apache
等等。