开发者

PHP code displays as text

I am certain that my code is correct, and before you say the file is called whatever.html I am positive that it is a .php It displays ALL of my code, and not starting from a specific point, oh and btw PHP works on other pages of mine. So PHP is installed Here is my code:

    <?
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 '$A开发者_C百科SID' 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>

Also, I have filtered it where nessasary


You have disabled short_open_tags in your php.ini, right? Then you have to start blocks of PHP code with <?php, not just <?.


Use <?php on the beginning.


Maybe the short-tags are disabled. Try using <?php instead of just <?


Apologies for replying to a very old post but I had exactly the same problem so my solution might help someone.

In my case it was an ID-ten-T problem.

I had two copies of the inserted code in two folders under identical names (I had set up an 'inserts' folder, copied the files across but failed to delete all the originals. So the code was including the original file but I was editing the copy. And the original didn't have the

ID-ten-T, for those who haven't come across it before, is sometimes written ID10T

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜