PHP命令显示在页面上

时间:2015-11-26 18:06:22

标签: php

不幸的是我的所有PHP命令都在页面上显示为HTML,我不知道为什么。我之前不得不使用它而没有错误。这里我的错误是什么? .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ..............................

<html>
<head>
<title>Add items system</title>
<?php
if (isset($_POST['submit']))
{
	if(isset($_POST['yes']))
	{
		file_put_contents('ak47content.html', '<li class="li1"><img src="images/'.$_POST["image"].'.png"><span><b>Available:</b> <br>'.$_POST['available'].'<br><br><img src="images/hiks.png"><br>&nbsp;</span></li>' . "\r\n", FILE_APPEND);
	}
	
else
{
	if(isset($_POST['no']))
	{
		file_put_contents('ak47content.html', '<li class="li1"><img src="images/'.$_POST['image'].'.png"><span><b>Available:</b> <br>'.$_POST['available'].'<br><br><img src="images/hiks.png"><br>&nbsp;</span></li>' . "\r\n", FILE_APPEND);
	}
		
	else
	{
		echo "Please specify if it's available or not!";
	}
}
	
	
	
	
}

?>
</head>
<body>

<form action="add.php" method="post" name="all">
<b>Available:</b> <input type="radio" name="yes" value="male">Yes <input type="radio" name="no" value="male">No <br>

<b>If NOT available, so when:</b>
	<select name="available">
			<option>Soon</option>
			<option>Next week</option>
			<option>Next month</option>
			<option>Next year</option>
		</select><br>
		
		
<b>Exteriors:</b>  <select name="exterior">
			<option>Battle-Scarred</option>
			<option>Factory New</option>
			<option>Minimal Wear, Battle-Scarred</option>
			<option>Field-Tested, Battle-Scarred</option>
			<option>Factory New, Field-Tested</option>
			</select><br>
<b>Image name:</b> <input type="text" name="image"><br>
<input type="submit" value="Add" name="submit">
</form>

</body>
</html>

1 个答案:

答案 0 :(得分:1)

它不被解释为PHP,请检查PHP是否已启动并运行! - 检查文件扩展名 - 确保php与您的服务器正确集成 - 尝试重新安装xampp