Php 网页从第一页重定向时显示空白页
我有一张显示空白页的表单。表单详细信息不会显示。这是一个空白页。用于显示会员编号、月日、金额等详细信息的表格。但是它是一个空白页,没有显示详细信息。代码有什么问题Php 网页从第一页重定向时显示空白页,php,mysql,Php,Mysql,我有一张显示空白页的表单。表单详细信息不会显示。这是一个空白页。用于显示会员编号、月日、金额等详细信息的表格。但是它是一个空白页,没有显示详细信息。代码有什么问题 <?php $username = "root"; $password = ""; $hostname = "localhost"; $db = "anthonys"; //connection to the database $dbhandle = mysql_connect($hostname, $username,
<?php
$username = "root";
$password = "";
$hostname = "localhost";
$db = "anthonys";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL");
mysql_select_db($db,$dbhandle) or die('cannot select db');
if(isset($_POST['update'])){
$uid=$_REQUEST['uid'];
$month=$_REQUEST['month'];
$date=$_POST['date'];
$amount=$_POST['amount'];
mysql_query("UPDATE payment SET uid='$uid',month ='$month', date='$date', amount='$amount' WHERE uid='$uid' and month='$month'") or die(mysql_error());
echo "<script>alert('Record Updated!!')</script>";
$myData= mysql_query("SELECT * FROM payment where uid='$uid' and month='$month'")or die(mysql_error());
while($record = mysql_fetch_assoc($myData))
{
?>
<section id="sheet" style="background-color: Transparent;">
<div id="content_inner">
<div id="col2">
<h2>PAYMENT RECEIPT</h2><br /><br />
<table border="0px" style="border-collapse:collapse; width:810px;" align="center">
<tr>
<td>
<form name="XIForm" id="XIForm" method="post" action="modifypay3.php">
<span style="float:right; width:500px;margin-top:-55px;">
<label type="text" name="uid" maxlength="50" size="30" class="label" >Membership No</label><br />
<input type="text" name="uid" value="<?php echo $record['uid'];?>"readonly><br /><br /></span>
<label type="text" name="month" maxlength="50" size="30" class="label">Month</label><br />
<input type="text" name="month" class="input" size="40" value="<?php echo $record['month']; ?>"> <br /><br />
<label type="text" name="date" maxlength="50" size="30" class="label">Date</label><br />
<input type="text" name="date" class="input" style="width:370px;" value="<?php echo $record['date']; ?>"><br /><br />
<label type="text" name="amount" maxlength="50" size="30" class="label">Amount Paid</label><br />
<input type="text" name="amount" class="input" size="39" value="<?php echo $record['amount']; ?>"> <br /><br />
<input type=hidden name=hidden value="<?php echo $record['uid'];?>"><br/><br/>
<input type="submit" name="submit" value="UPDATE" class="button" />
</form>
<?php }?>
<?php }?>
</body>
</html>
使用PDO比使用mysql\u connect更安全。
只有在您发布表单时才打印表单。如果需要,请使用下面的代码和测试
<?php
$username = "root";
$password = "";
$hostname = "localhost";
$db = "anthonys";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL");
mysql_select_db($db,$dbhandle) or die('cannot select db');
if(isset($_POST['submit'])){
$uid=$_REQUEST['uid'];
$month=$_REQUEST['month'];
$date=$_POST['date'];
$amount=$_POST['amount'];
mysql_query("UPDATE payment SET uid='$uid',month ='$month', date='$date', amount='$amount' WHERE uid='$uid' and month='$month'") or die(mysql_error());
echo "<script>alert('Record Updated!!')</script>";
};
$myData= mysql_query("SELECT * FROM payment where uid='$uid' and month='$month'")or die(mysql_error());
while($record = mysql_fetch_assoc($myData))
{?>
<section id="sheet" style="background-color: Transparent;">
<div id="content_inner">
<div id="col2">
<h2>PAYMENT RECEIPT</h2><br /><br />
<table border="0px" style="border-collapse:collapse; width:810px;" align="center">
<tr>
<td>
<form name="XIForm" id="XIForm" method="post" action="modifypay3.php">
<span style="float:right; width:500px;margin-top:-55px;">
<label type="text" name="uid" maxlength="50" size="30" class="label" >Membership No</label><br />
<input type="text" name="uid" value="<?php echo $record['uid'];?>"readonly><br /><br /></span>
<label type="text" name="month" maxlength="50" size="30" class="label">Month</label><br />
<input type="text" name="month" class="input" size="40" value="<?php echo $record['month']; ?>"> <br /><br />
<label type="text" name="date" maxlength="50" size="30" class="label">Date</label><br />
<input type="text" name="date" class="input" style="width:370px;" value="<?php echo $record['date']; ?>"><br /><br />
<label type="text" name="amount" maxlength="50" size="30" class="label">Amount Paid</label><br />
<input type="text" name="amount" class="input" size="39" value="<?php echo $record['amount']; ?>"> <br /><br />
<input type=hidden name=hidden value="<?php echo $record['uid'];?>"><br/><br/>
<input type="submit" name="submit" value="UPDATE" class="button" />
</form>
<?php }?>
</body>
</html>
添加错误报告(E\u ALL);ini_集('display_errors','1')代码>到该文件并捕获任何可能的错误。必须尝试回显查询。它将显示空白页