gpt4 book ai didi

PHP 代码显示为文本

转载 作者:行者123 更新时间:2023-11-27 22:50:13 25 4
gpt4 key购买 nike

我确信我的代码是正确的,在你说文件名为 whatever.html 之前,我肯定它是一个 .php它显示我的所有代码,而不是从特定点开始,哦,顺便说一句,PHP 在我的其他页面上工作。所以安装了PHP这是我的代码:

    <?
include("include/session.php");
$ASID = $_GET['id'];
$BOATNAME = $_GET['moorings'];
$LoginName = 'Log in';
if($session->logged_in){
$LoginName = 'Account Center';
}
$con = mysql_connect("********","******","*************2");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("****", $con);
$query = "select * from **** where **** like '$ASID' AND BoatName like '$BOATNAME'";
$result = mysql_query($query) or die("Couldn't execute query");
while ($row= mysql_fetch_array($result)) {
$MooringList = $row["MooringList"];
$MooringList2 = $row["MooringList2"];
$Number = $row["Number"];
$Latitude = $row["Latitude"];
$Latitude2 = $row["Latitude2"];
$Latitude3 = $row["Latitude3"];
$Longitude = $row["Longitude"];
$Longitude2 = $row["Longitude2"];
$Longitude3 = $row["Longitude3"];
$Schedule = $row["Schedule"];
$ScheduleCD = $row["ScheduleCD"];
$MoorLengthFT = $row["MoorLengthFT"];
$MoorLengthMtrs = $row["MoorLengthMTRS"];
$MoorTonnage = $row["MoorTonnage"];
$Layer = $row["Layer"];
$BoatName = $row["BoatName"];
$BoatType = $row["BoatType"];
$BoatLengthFT = $row["BoatLengthFT"];
$BoatLengthMTRS = $row["BoatLengthMTRS"];
$BoatInsurance = $row["BoatInsurance"];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>**** - Add Mooring</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="js/jquery-1.3.2.js" type="text/javascript"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#myform").validate({
debug: false,
rules: {
Number:"required"
},
messages: {
Number:"* The number can't be blank"
},
submitHandler: function(form) {
// do other stuff for a valid form
$.post('addMooringScript.php', $("#myform").serialize(), function(data) {
$('#result').html(data);
});
}
});
});
</script>
<style>
label.error { width: 250px; display: inline; color: red;}
</style>
</head>
<body>
<div id="header">
<h1>******</h1>
<div id="loginDetails">
<? include('loggedInTopStatus.php'); ?>
</div>
</div>
<div class="content"><br />
<div id="news">
<div id="right">
<form name="myform" id="myform" action="" method="POST">
<h2>Moorings - Add</h2>
<div id="result"></div>
<table width = "2000" border="0">
<tr width="1000">
<input type="hidden" name="AssignedTo" value ="<? $_POST['id'] ?> "/>
<tr>
<td width="50px">Mooring List: </td>
<td>
<input type="text" name="MooringList" size="5" value="<? echo $MooringList; ?>" />
<input type="text" name="MooringList2" size="20" value="<? echo $MooringList2; ?>" />
</tr></td>
<tr><td width="50px">Number: </td><td><input type="text" name="Number" maxlength="30" value="<? echo $Number ?>"></td></td>
<tr><td width="50px">Latitude: </td><td>
<input type="text" name="Latitude" size="3" value="<? echo $Latitude; ?>" />O
<input type="text" name="Latitude2" size="3" value="<? echo $Latitude2; ?>" />' .
<input type="text" name="Latitude3" size="5" value="<? echo $Latitude3; ?>" />
</tr></td>
<tr><td width="50px">Longitude: </td><td>
<input type="text" name="Longitude" size="3" value="<? echo $Longitude; ?>" />O
<input type="text" name="Longitude2" size="3" value="<? echo $Longitude2; ?>" />' .
<input type="text" name="Longitude3" size="5" value="<? echo $Longitude3; ?>" />
</tr></td>
<tr><td width="50px">Schedule: </td><td>
<input type="text" name="Schedule" size="3" /> CD
<input type="text" name="ScheduleMtrs" size="3" /> Mtrs
</tr></td>
<tr><td width="50px">Moor Length: </td><td>
<input type="text" name="Moorlength" size="3" /> FT
<input type="text" name="MoorlengthMtrs" size="3" /> Mtrs
</tr></td>
<tr><td width="50px">Moor Tonnage: </td><td>
<input type="text" name="MoorTonnage" size="4" />
</tr></td>
<tr><td width="50px">Layer: </td><td>
<input type="text" name="Layer" size="8" />
</tr></td>
<tr><td width="50px">Boat Name: </td><td>
<input type="text" name="BoatName" size="15" />
<input type="radio" name="BoatType" value="Leisure" /><b> Leisure </b>
</tr></td>
<tr><td width="50px">Type: </td><td>
<input type="text" name="Type" size="15" />
<input type="radio" name="BoatType" value="Commercial" /> <b>Commercial </b>
</tr></td>
<tr><td width="50px">Length: </td><td>
<input type="text" name="LengthFt" size="8" />Ft
<input type="text" name="LengthMtrs" size="8" />Mtrs
</tr></td>
<tr><td width="50px">Insurance: </td><td>
<input type="text" name="Insurance" size="18" />
</tr></td>
</tr>
<input type="hidden" name="id" value="<? echo $_GET['id']; ?>" />
<tr><td><input type="submit" value="Edit Mooring" /> </tr></td>
</table>
</form>
</div>
<div class="left">
<? include('sitemenu.php'); ?>
</div>
<br />

<div id="footer">
<a href="#">&copy; 2010 *****</a>
</div>
</div>
</div>
</body>
</html>

此外,我在必要的地方过滤了它

最佳答案

您在 php.ini 中禁用了 short_open_tags,对吗?然后你必须以 <?php 开始 PHP 代码块。 ,不只是 <? .

关于PHP 代码显示为文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4378678/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com