我正在尝试在更新之前编辑数据库。首先我尝试使用 echo 编辑数据库,之后我想更新同一个表中的所需字段。请在下面找到我的代码....请帮助...我需要获取来自数据库患者的值,需要在同一个表中更新....
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Form Edit Data</title>
</head>
<body>
<table border=1>
<tr>
<td align=center>MODIFY PATIENT DATA</td>
</tr>
<tr>
<td>
<table>
<? include "db.php";//database connection $pid=$_POST[ 'pid']; $name=$_POST[
'name']; $age=$_POST[ 'age']; $sex=$_POST[ 'sex']; $mobileno=$_POST[
'mobileno']; $vaccine=$_POST[ 'vaccine']; $diagno=$_POST[ 'diagno']; $fee=$_POST[
'fee']; $order=s printf( "SELECT * FROM `hms`.`patient` WHERE pid='%s'", mysql_real_escape_string($pid));
$result=m ysql_query($order); if (!$result) die( 'Error: (' . mysql_errno()
. ') ' . mysql_error()); $row=m ysql_fetch_assoc($result); ?>
<form method="post" action="update1.php">
<table style=" border:5px solid silver" cellpadding="10px" cellspacing="10px"
align="center" border="0">
<tr>
<td colspan="4" style="background:#0066FF; color:#FFFFFF; fontsize:20px">PATIENT DETAILS</td>
</tr>
<tr>
<td>Patient Name</td>
<td>
<input type="text" name="name" size="20" value=<?php echo $row[ 'name'];
?>
</td>
</tr>
<tr>
<td>Patient ID</td>
<td>
<input type="text" name="pid" size="20" value=<?php echo $row[ 'pid'];
?>
</td>
</tr>
<tr>
<td>Age</td>
<td>
<input type="text" name="age" size="10" value=<?php echo $row[ 'age'];
?>
</td>
</tr>
<tr>
<td>Sex</td>
<td>
<input type="text" name="sex" size="20" value=<?php echo $row[ 'sex'];
?>?>">
<tr>
<td>Mobile No.</td>
<td>
<input type="text" name="mobileno" size="20" value=<?php echo $row[
'mobileno']; ?>
</td>
</tr>
<tr>
<td>Diagnosis</td>
<td>
<input type="text" name="diagno" size="40" value=<?php echo $row[
'diagno']; ?>
</td>
</tr>
<tr>
<td>Vaccine</td>
<td>
<input type="text" name="vaccine" size="20" value=<?php echo $row[
'vaccine']; ?>
</td>
</tr>
<tr>
<td>Fee Received</td>
<td>
<input type="text" name="fee" size="20" value=<?php echo $row[ 'fee'];
?>
<tr>
<td align="right">
<input type="submit" name="submit value" value="UPDATE">
</td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html>
我的表显示如下值:
Patient Name <? echo ">
Patient ID <? echo ">
.
.
.
.
Fee Received <? echo ">
它显示<? echo ">
我尝试使用<?php echo ">
但给出错误....