0

我似乎对这行代码有问题,它应该通过浏览器地址栏中的引用字段。

echo <a href="update.php?Reference=<? echo $rows['Reference']; ?>">update</a>

它在地址栏中应该是这样的“localip/update.php?Reference=123456”

而是像这样“localip/update.php?Reference=”

它似乎没有通过该字段进入地址栏中以显示有关表中该行的信息。

任何帮助将不胜感激(对所有这一切都很新)

干杯

更新 -

require_once('auth.php');

$host=""; // Host name 
$username=""; // Mysql username
$password=""; // Mysql password 
$db_name=""; // Database name 
$tbl_name=""; // 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");

 $Reference=$_POST['Reference'];
 $directly = $_POST['directly'];
 $behalfclient = $_POST['behalfclient'];
 $investigations = $_POST['investigations'];
 $injuries = $_POST['injuries'];
 $duties = $_POST['duties'];
 $Wherepain = $_POST['Wherepain'];
 $pain = $_POST['pain'];
 $aggravates = $_POST['aggravates'];
 $eases = $_POST['eases'];
 $Movement = $_POST['Movement'];
 $neural = $_POST['neural'];
 $UnderstandNPRS = $_POST['UnderstandNPRS'];
 $NPRSassessment = $_POST['NPRSassessment'];
 $yourhobbies = $_POST['yourhobbies'];
 $hobbiesaffected = $_POST['hobbiesaffected'];
 $social = $_POST['social'];
 $activities = $_POST['activities'];
 $lifestyle = $_POST['lifestyle'];
 $avoiddriving = $_POST['avoiddriving'];
 $grip = $_POST['grip'];
 $flashbacks = $_POST['flashbacks'];
 $braking = $_POST['braking'];
 $past = $_POST['past'];
 $psychologically = $_POST['psychologically'];
 $stomach = $_POST['stomach'];
 $dental = $_POST['dental'];
 $organs = $_POST['organs'];
 $genitals = $_POST['genitals'];
 $memory = $_POST['memory'];
 $scaring = $_POST['scaring'];
 $deformity = $_POST['deformity'];
 $eyes = $_POST['eyes'];
 $burns = $_POST['burns'];
 $head = $_POST['head'];
 $symptoms = $_POST['symptoms'];
 $otherchanges = $_POST['otherchanges'];
 $receivingtreatment = $_POST['receivingtreatment'];
 $surgery = $_POST['surgery'];
 $Impression = $_POST['Impression'];
 $management = $_POST['management'];
 $ifyes = $_POST['ifyes'];
 $Rehabilitation = $_POST['Rehabilitation'];
 $Number = $_POST['Number'];
 $Psychological = $_POST['Psychological'];
 $diagnostic = $_POST['diagnostic'];
 $notrequiretreatment = $_POST['notrequiretreatment'];
 $house = $_POST['house'];
 $recommendations = $_POST['recommendations'];
 $Prognosis = $_POST['Prognosis'];
 $CV = $_POST['CV'];
 $cervical = $_POST['cervical'];
 $heat = $_POST['heat'];
 $ice = $_POST['ice'];
 $lumbar = $_POST['lumbar'];
 $medication = $_POST['medication'];
 $posture = $_POST['posture'];
 $sport = $_POST['sport'];
 $given = $_POST['given'];
 $sceneaccident = $_POST['sceneaccident'];

 $sql="UPDATE Triage SET sceneaccident='$sceneaccident', notrequiretreatment='$notrequiretreatment', house='$house', recommendations='$recommendations', Prognosis='$Prognosis', CV='$CV', cervical='$cervical', heat='$heat', ice='$ice', lumbar='$lumbar', medication='$medication', posture='$posture', sport='$sport', given='$given' ,organs='$organs', deformity='$deformity', otherchanges='$otherchanges', receivingtreatment='$receivingtreatment', surgery='$surgery', Impression='$Impression', management='$management', ifyes='$ifyes', Rehabilitation='$Rehabilitation', Number='$Number', Psychological='$Psychological', diagnostic='$diagnostic', eyes='$eyes', burns='$burns', head='$head', symptoms='$symptoms', memory='$memory', scaring='$scaring', genitals='$genitals', dental='$dental', stomach='$stomach', directly='$directly', behalfclient='$behalfclient', investigations='$investigations', injuries='$injuries', duties='$duties', Wherepain='$Wherepain', pain='$pain', aggravates='$aggravates', eases='$eases', Movement='$Movement', neural='$neural', UnderstandNPRS='$UnderstandNPRS', NPRSassessment='$NPRSassessment', yourhobbies='$yourhobbies', hobbiesaffected='$hobbiesaffected', social='$social', activities='$activities', lifestyle='$lifestyle', avoiddriving='$avoiddriving', grip='$grip', flashbacks='$flashbacks', braking='$braking', past='$past', psychologically='$psychologically' WHERE Reference='$Reference'";
 $result=mysql_query($sql);


if (!$_POST['sceneaccident'] || !$_POST['notrequiretreatment'] || !$_POST['house'] || !$_POST['recommendations'] || !$_POST['Prognosis'] || !$_POST['CV'] || !$_POST['cervical'] || !$_POST['heat'] || !$_POST['ice'] || !$_POST['lumbar'] || !$_POST['medication'] || !$_POST['posture'] || !$_POST['sport'] || !$_POST['given'] || !$_POST['organs'] || !$_POST['deformity'] || !$_POST['otherchanges'] || !$_POST['receivingtreatment'] || !$_POST['surgery'] || !$_POST['Impression'] || !$_POST['management'] || !$_POST['ifyes'] || !$_POST['Rehabilitation'] || !$_POST['Number'] || !$_POST['Psychological'] || !$_POST['diagnostic'] || !$_POST['eyes'] || !$_POST['burns'] || !$_POST['head'] || !$_POST['symptoms'] || !$_POST['memory'] || !$_POST['scaring'] || !$_POST['genitals'] || !$_POST['dental'] || !$_POST['stomach'] || !$_POST['directly'] || !$_POST['behalfclient'] || !$_POST['investigations'] || !$_POST['injuries'] || !$_POST['duties'] || !$_POST['Wherepain'] || !$_POST['pain'] || !$_POST['aggravates'] || !$_POST['eases'] || !$_POST['Movement'] || !$_POST['neural'] || !$_POST['UnderstandNPRS'] || !$_POST['NPRSassessment'] || !$_POST['yourhobbies'] || !$_POST['hobbiesaffected'] || !$_POST['social'] || !$_POST['activities'] || !$_POST['lifestyle'] || !$_POST['avoiddriving'] || !$_POST['grip'] || !$_POST['flashbacks'] || !$_POST['braking'] || !$_POST['past'] || !$_POST['psychologically'] )

{
 echo ('You did not complete all of the required fields');
 echo "<BR>";
 echo '<a href="update.php?Reference='. $rows['Reference'].' ">update</a>'; 
 }
 else {
 echo "Successful";
 echo "<BR>";
 echo "<a href='list_records.php'>View result</a>";
 } 

 ?>

更新 2

// 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");

 $Reference=$_REQUEST['Reference'];
 $directly = $_REQUEST['directly'];
 $behalfclient = $_REQUEST['behalfclient'];
 $investigations = $_REQUEST['investigations'];
 $injuries = $_REQUEST['injuries'];
 $duties = $_REQUEST['duties'];
 $Wherepain = $_REQUEST['Wherepain'];
 $pain = $_REQUEST['pain'];
 $aggravates = $_REQUEST['aggravates'];
 $eases = $_REQUEST['eases'];
 $Movement = $_REQUEST['Movement'];
 $neural = $_REQUEST['neural'];
 $UnderstandNPRS = $_REQUEST['UnderstandNPRS'];
 $NPRSassessment = $_REQUEST['NPRSassessment'];
 $yourhobbies = $_REQUEST['yourhobbies'];
 $hobbiesaffected = $_REQUEST['hobbiesaffected'];
 $social = $_REQUEST['social'];
 $activities = $_REQUEST['activities'];
 $lifestyle = $_REQUEST['lifestyle'];
 $avoiddriving = $_REQUEST['avoiddriving'];
 $grip = $_REQUEST['grip'];
 $flashbacks = $_REQUEST['flashbacks'];
 $braking = $_REQUEST['braking'];
 $past = $_REQUEST['past'];
 $psychologically = $_REQUEST['psychologically'];
 $stomach = $_REQUEST['stomach'];
 $dental = $_REQUEST['dental'];
 $organs = $_REQUEST['organs'];
 $genitals = $_REQUEST['genitals'];
 $memory = $_REQUEST['memory'];
 $scaring = $_REQUEST['scaring'];
 $deformity = $_REQUEST['deformity'];
 $eyes = $_REQUEST['eyes'];
 $burns = $_REQUEST['burns'];
 $head = $_REQUEST['head'];
 $symptoms = $_REQUEST['symptoms'];
 $otherchanges = $_REQUEST['otherchanges'];
 $receivingtreatment = $_REQUEST['receivingtreatment'];
 $surgery = $_REQUEST['surgery'];
 $Impression = $_REQUEST['Impression'];
 $management = $_REQUEST['management'];
 $ifyes = $_REQUEST['ifyes'];
 $Rehabilitation = $_REQUEST['Rehabilitation'];
 $Number = $_REQUEST['Number'];
 $Psychological = $_REQUEST['Psychological'];
 $diagnostic = $_REQUEST['diagnostic'];
 $notrequiretreatment = $_REQUEST['notrequiretreatment'];
 $house = $_REQUEST['house'];
 $recommendations = $_REQUEST['recommendations'];
 $Prognosis = $_REQUEST['Prognosis'];
 $CV = $_REQUEST['CV'];
 $cervical = $_REQUEST['cervical'];
 $heat = $_REQUEST['heat'];
 $ice = $_REQUEST['ice'];
 $lumbar = $_REQUEST['lumbar'];
 $medication = $_REQUEST['medication'];
 $posture = $_REQUEST['posture'];
 $sport = $_REQUEST['sport'];
 $given = $_REQUEST['given'];
 $sceneaccident = $_REQUEST['sceneaccident'];

 $sql="UPDATE Triage SET sceneaccident='$sceneaccident', notrequiretreatment='$notrequiretreatment', house='$house', recommendations='$recommendations', Prognosis='$Prognosis', CV='$CV', cervical='$cervical', heat='$heat', ice='$ice', lumbar='$lumbar', medication='$medication', posture='$posture', sport='$sport', given='$given' ,organs='$organs', deformity='$deformity', otherchanges='$otherchanges', receivingtreatment='$receivingtreatment', surgery='$surgery', Impression='$Impression', management='$management', ifyes='$ifyes', Rehabilitation='$Rehabilitation', Number='$Number', Psychological='$Psychological', diagnostic='$diagnostic', eyes='$eyes', burns='$burns', head='$head', symptoms='$symptoms', memory='$memory', scaring='$scaring', genitals='$genitals', dental='$dental', stomach='$stomach', directly='$directly', behalfclient='$behalfclient', investigations='$investigations', injuries='$injuries', duties='$duties', Wherepain='$Wherepain', pain='$pain', aggravates='$aggravates', eases='$eases', Movement='$Movement', neural='$neural', UnderstandNPRS='$UnderstandNPRS', NPRSassessment='$NPRSassessment', yourhobbies='$yourhobbies', hobbiesaffected='$hobbiesaffected', social='$social', activities='$activities', lifestyle='$lifestyle', avoiddriving='$avoiddriving', grip='$grip', flashbacks='$flashbacks', braking='$braking', past='$past', psychologically='$psychologically' WHERE Reference='$Reference'";
 $result=mysql_query($sql);

// test by Fred start
 while($rows=mysql_fetch_array($result)){
 echo '<a href="update.php?Reference='. $rows['Reference'].' ">update test</a>';
 }
// test by Fred end


if (!$_REQUEST['sceneaccident'] || !$_REQUEST['notrequiretreatment'] || !$_REQUEST['house'] || !$_REQUEST['recommendations'] || !$_REQUEST['Prognosis'] || !$_REQUEST['CV'] || !$_REQUEST['cervical'] || !$_REQUEST['heat'] || !$_REQUEST['ice'] || !$_REQUEST['lumbar'] || !$_REQUEST['medication'] || !$_REQUEST['posture'] || !$_REQUEST['sport'] || !$_REQUEST['given'] || !$_REQUEST['organs'] || !$_REQUEST['deformity'] || !$_REQUEST['otherchanges'] || !$_REQUEST['receivingtreatment'] || !$_REQUEST['surgery'] || !$_REQUEST['Impression'] || !$_REQUEST['management'] || !$_REQUEST['ifyes'] || !$_REQUEST['Rehabilitation'] || !$_REQUEST['Number'] || !$_REQUEST['Psychological'] || !$_REQUEST['diagnostic'] || !$_REQUEST['eyes'] || !$_REQUEST['burns'] || !$_REQUEST['head'] || !$_REQUEST['symptoms'] || !$_REQUEST['memory'] || !$_REQUEST['scaring'] || !$_REQUEST['genitals'] || !$_REQUEST['dental'] || !$_REQUEST['stomach'] || !$_REQUEST['directly'] || !$_REQUEST['behalfclient'] || !$_REQUEST['investigations'] || !$_REQUEST['injuries'] || !$_REQUEST['duties'] || !$_REQUEST['Wherepain'] || !$_REQUEST['pain'] || !$_REQUEST['aggravates'] || !$_REQUEST['eases'] || !$_REQUEST['Movement'] || !$_REQUEST['neural'] || !$_REQUEST['UnderstandNPRS'] || !$_REQUEST['NPRSassessment'] || !$_REQUEST['yourhobbies'] || !$_REQUEST['hobbiesaffected'] || !$_REQUEST['social'] || !$_REQUEST['activities'] || !$_REQUEST['lifestyle'] || !$_REQUEST['avoiddriving'] || !$_REQUEST['grip'] || !$_REQUEST['flashbacks'] || !$_REQUEST['braking'] || !$_REQUEST['past'] || !$_REQUEST['psychologically'] )

{
 echo ('You did not complete all of the required fields');
 echo "<BR>";
 echo '<a href="update.php?Reference='. $rows['Reference'].' ">update</a>'; 
 }
 else {
 echo "Successful";
 echo "<BR>";
 echo "<a href='list_records.php'>View result</a>";
 } 

 ?> 

更新 3

{
 echo ('You did not complete all of the required fields');
 echo "<BR>";
 while($rows=mysql_fetch_array($result)){
 echo '<a href="update.php?Reference='. $rows['Reference'].' ">update</a>';
 }}
 else {
 echo "Successful";
 echo "<BR>";
 echo "<a href='list_records.php'>View result</a>";
 } 

更新 4

 {
 echo ('You did not complete all of the required fields');
 echo "<BR>";
 while($rows=mysql_fetch_array($result)){
 echo '<a href="update.php?Reference= ">update</a>';
 }}
 else {
 echo "Successful";
 echo "<BR>";
 echo "<a href='list_records.php'>View result</a>";
 }

更新 5

{
 echo ('You did not complete all of the required fields');
 echo "<BR>";
 while($rows=mysql_fetch_array($result)){
 echo '<a href="update.php?Reference='. $rows['Reference'].' ">update</a>';
 }
 } // end of while loop
 else {
 echo "Successful";
 echo "<BR>";
 echo "<a href='list_records.php'>View result</a>";
 }

更新 6

<?php

require_once('auth.php');

 $host="xxx"; // Host name 
 $username="xxx"; // Mysql username 
 $password="xxx"; // Mysql password 
 $db_name="xxx"; // Database name 
 $tbl_name="xxx"; // 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");

// get value of Reference that sent from address bar
 $Reference=$_GET['Reference'];

// Retrieve data from database 
 $sql="SELECT * FROM $tbl_name WHERE Reference='$Reference'";
 $result=mysql_query($sql);

$rows=mysql_fetch_array($result);
 ?>
4

1 回答 1

0

尝试这样的事情

echo "<a href='update.php?Reference='". $rows['Reference']."'>update</a>";
于 2013-10-24T11:56:39.130 回答