我的代码中有两个问题。但首先这是完整的代码集
<html>
<title>IMS:MPP | Home</title>
<script type="text/javascript">
function PopupCenter(pageURL, title,w,h)
{
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
var state = new Array();
for (i=0; i<1; i++) {
state[i] = "none";
}
</script>
<head>
<link href="officerStyle.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<script type="text/javascript" src="jsDatePick.min.1.3.js"></script>
<script type="text/javascript">
window.onload = function(){
new JsDatePick({
useMode:2,
target:"inputField",
cellColorScheme: "armygreen",
limitToToday:true,
});
};
$(function() {
$("#inputField1").JsDatePick();
}
)
;
</script>
<!-- End -->
<?php
if(isset($_REQUEST['inputField1']))
$inputField1 = $_REQUEST['inputField1'];
else
$inputField1 = "";
include('global.php');
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="mpp"; // Database name
$tbl_name="userinfo"; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
//$_SESSION['myusername'] = $row['Username'];
//$_SESSION['mypassword'] = $row['UserID'];
$myusername=$_SESSION['myusername'];
//$mypassword=$_SESSION['mypassword'];
//require("mainlogin.php");
//$id = $_SESSION['myusername']; //Get user's ID
$result = mysql_query("SELECT * FROM $tbl_name where Username='$myusername'");
$row = mysql_fetch_assoc($result);
$type = $row['UserType'];
?>
<body>
<div id="wrapper">
<div id="header">
<img id="logos" src="images/logo.png" style="opacity:0.7;filter:alpha(opacity=70)"
onmouseover="this.style.opacity=0.7;this.filters.alpha.opacity=70"
onmouseout="this.style.opacity=1;this.filters.alpha.opacity=100" border="none"/>
<a href="logout.php" onclick="return confirm ('Are you sure you want to Log Out?')"><img id="out" src="images/Outbtn.png" style="opacity:0.7;filter:alpha(opacity=70)"
onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"
onmouseout="this.style.opacity=0.7;this.filters.alpha.opacity=70" border="none"/></a>
</div>
<div id="page">
<div id="page-bgbtm">
<div id="menu">
<?php
/*------------------------------------------------------------ Encoder ------------------------------------------------------------*/
if ($type=="Encoder"){
//Navigation
echo " <ul>
<li class='current_page_item'> <a href='#'>Home</a> </li>
<li> <a href='SalesOfficer.php'>Sales</a> </li>
<li> <a href='PromoOfficer.php'>Promo</a> </li>
<li> <a href='BankOfficer.php'>Bank</a> </li>
<li> <a href='PlanOfficer.php'>Plan</a> </li>
<li> <a href='User.php'>User</a> </li>
<li> <a href='Client.php'>Client</a> </li>
</ul>
</div>";
//Texts
echo " <br/><br/><h1 class='title'><a href='#'>Welcome</a></h1>
<div class='entry'>";
echo "<h3>" . $row['UserType'] . " " . $row['FirstName'] . "</h3>";
echo "<div class='post'></br>
<h3 class='title'>TODAY: Walk-In Clients</a></h3>";
echo "<h4 class ='title'>" . date("F d, Y") . date(" (D)");
echo "</h4></div>";
//TableHeader
echo "<table border='1' cellpadding='5'>
<tr>
<th>Time In</th>
<th>Last Name</th>
<th>First Name</th>
<th>Middle Name</th>
<th>Promo Officer Name</th>
<th>Action</th>
</tr>";
/*------------------------------------------------------------ GoToDateTable ------------------------------------------------------------*/
//GoToDate
echo " <link rel='stylesheet' type='text/css' media='all' href='jsDatePick_ltr.min.css' />";
echo"<form name='sdate' action='#' method='post'>";
echo"<input type='text' size='12' id='inputField' name='inputField1'>";
echo"<a href='#' onclick='validateForm(document.forms['sdate'].action);return false;><img src='images/go.png' height='27' width='60'></a>";
//GoToDateQuery
$result = mysql_query("SELECT TimeIn,LastName, FirstName, MiddleName ,PromoOfficerName FROM timein WHERE DateTrans='".$inputField1."'");
//TableAlternateFieldColor
$sw = 0;
while($row = mysql_fetch_array($result))
{
if($sw == 0)
{
$mycolor = "#fff";
$sw = 1;
}
else
{
$mycolor = "#79b669";
$sw = 0;
}
//TableRowAndTableData
echo "<tr bgcolor='".$mycolor."'>";
echo "<td>" . $row['TimeIn'] . "</td>";
echo "<td>" . $row['LastName'] . "</td>";
echo "<td>" . $row['FirstName'] . "</td>";
echo "<td>" . $row['MiddleName'] . "</td>";
echo "<td>" . $row['PromoOfficerName'] . "</td>";
echo "<td><image src='images/out.png' height=27 width=60></td>";
echo "</tr>";
}
/*------------------------------------------------------------ DateTodayTable ------------------------------------------------------------*/
$datetoday=date("m.d.Y");
$result = mysql_query("SELECT TimeIn,LastName, FirstName, MiddleName ,PromoOfficerName FROM timein WHERE DateTrans='".$datetoday."'");
$sw = 0;
while($row = mysql_fetch_array($result))
{
if($sw == 0)
{
$mycolor = "#fff";
$sw = 1;
}
else
{
$mycolor = "#79b669";
$sw = 0;
}
echo "<tr bgcolor='".$mycolor."'>";
echo "<td>" . $row['TimeIn'] . "</td>";
echo "<td>" . $row['LastName'] . "</td>";
echo "<td>" . $row['FirstName'] . "</td>";
echo "<td>" . $row['MiddleName'] . "</td>";
echo "<td>" . $row['PromoOfficerName'] . "</td>";
echo "<td> <a href='#' onclick = PopupCenter('timeoutform.php?salesID=<?$row['PlanHoldersID']?>','myPop1',400,430)><image src='images/out.png' height=27 width=60> </a> </td>";
echo "</tr>";
}
echo "<a href='#' onclick = PopupCenter('timeinform.php','myPop1',400,430)> <img src = 'images/add.png' height='27' width='60'> </a>";
}
/*------------------------------------------------------------ Administrator ------------------------------------------------------------*/
elseif ($type=="Administrator"){
echo "<ul>
<li class='current_page_item'> <a href='#'>Home</a> </li>
<li> <a href='#'>Daily</a> </li>
<li> <a href='#'>Weekly</a> </li>
<li> <a href='#'>Commission</a> </li>
<li> <a href='#'>Client</a> </li>
</ul> </div>";
echo " <br/><br/><h1 class='title'><a href='#'>Welcome</a></h1>
<div class='entry'>";
echo "<h3>" . $row['UserType'] . " " . $row['FirstName'] . "</h3>";
}
?>
</div>
</div>
</div>
</div>
<div id="footer-wrapper">
<div id="footer">
<p>Copyright (c) 2010 Sitename.com. All rights reserved. Design by FCT.</p>
</div>
</div>
</body>
</html>
问题1:
//GoToDate
echo " <link rel='stylesheet' type='text/css' media='all' href='jsDatePick_ltr.min.css' />";
echo"<form name='sdate' action='#' method='post'>";
echo"<input type='text' size='12' id='inputField' name='inputField1'>";
echo"<a href='#' onclick='validateForm(document.forms['sdate'].action);return false;><img src='images/go.png' height='27' width='60'></a>";
这是一个获取日期的文本框和一个触发查询以显示给定日期下的数据的按钮。问题是它在手动输入日期时有效,但在使用日期选择器时无效。
问题2:
echo "<td> <a href='#' onclick = PopupCenter('timeoutform.php?salesID=<?$row['PlanHoldersID']?>','myPop1',400,430)><image src='images/out.png' height=27 width=60> </a> </td>";
echo "</tr>";
这个按钮应该显示timeoutform.php
,但它显示 ff。错误
解析错误:解析错误,
T_STRING' or
在第 209 行的 C:\wamp\www\IMS-MPP(Encoder)\home.php 中需要 T_VARIABLE' 或 `T_NUM_STRING'
希望有人能帮忙。非常感谢!