数据库搜索页面的PHP语法错误帮助

时间:2012-11-23 14:32:59

标签: php html

当我在我的网络服务器上运行这个PHP页面时,它无法在搜索按钮周围正确显示。文本框区域。

PHP不是我的专长,所以如果有人可以请他们熟练地盯着我并告诉我错误在哪里,这将是一个很大的帮助。

提前谢谢你......

<html>
<head>
</head>
<body vlink="#0000FF" alink="#0000FF"> 
<? include 'vars.php'; ?> 
<? include 'searchfunct.php'; ?> 
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0"   bgcolor="#66FFCC"> 
<tr> 
<td> <p align="center"> <font face="Arial"><a href="search.php">Search</a></font></p> 
  <form action="search.php" method="get"> 
    <div align="center"><font face="Arial"> 
      <input maxLength="100" size="60" value**="<?= htmlspecialchars(stripslashes($_GET["search"])); ?>" name="search">** 
      <input type="submit" value="Search" > 
      </p> 
      </font> </div> 
  </form></td> 
</tr> 
</table> 
<div align="left"> 
<?
$search=stripslashes($_GET["search"]);
$page=$_GET["page"];
if($search!="")
fSearch($search,$page,$server,$user,$pass,$database,$Logging,$ResultsPerPage);
?> 
</div> 
<br>
<br>
<div style="color:#CCCCCC; text-align:center;">Developed By Stefano Alimonti And  Stefano Fantin</div> 
</body>
</html>

3 个答案:

答案 0 :(得分:2)

禁用php短标记可能是一个问题

您可以将<?=替换为<?php echo

<?<?php

答案 1 :(得分:1)

由于<? and <?=已在php的最新版本中弃用,我已将其替换为"<?php""<?php echo"

更新的html将是

<html>
<head>
</head>
<body vlink="#0000FF" alink="#0000FF"> 
<?php include 'vars.php'; ?> 
<?php include 'searchfunct.php'; ?> 
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0"   bgcolor="#66FFCC"> 
<tr> 
<td> <p align="center"> <font face="Arial"><a href="search.php">Search</a></font></p> 
  <form action="search.php" method="get"> 
    <div align="center"><font face="Arial"> 
      <input maxLength="100" size="60" value="<?php echo htmlspecialchars(stripslashes($_GET["search"])); ?>" name="search">** 
      <input type="submit" value="Search" > 
      </p> 
      </font> </div> 
  </form></td> 
</tr> 
</table> 
<div align="left"> 
<?php
$search=stripslashes($_GET["search"]);
$page=$_GET["page"];
if($search!="")
   fSearch($search,$page,$server,$user,$pass,$database,$Logging,$ResultsPerPage);
?> 
</div> 
<br>
<br>
<div style="color:#CCCCCC; text-align:center;">Developed By Stefano Alimonti And  Stefano Fantin</div> 
</body>
</html>

如果在评论

中发出确切错误后仍然出错

答案 2 :(得分:0)

此标记看起来不正确:

<input maxLength="100" size="60" value**="<?= htmlspecialchars(stripslashes($_GET["search"])); ?>" name="search">**

尝试:

<input maxLength="100" size="60" value="**<?php htmlspecialchars(stripslashes($_GET['search'])); ?>**" name="search">