私が抱えている問題は、フォームが送信されたときにフィールドが欠落しているときに、「必要なフィールドのすべてを完了していません」と言ってから、フォームに戻るリンクを持っていることです。ただし、リンクはフォームに戻りますが、アドレスバーに参照が入力されていないため、フィールドが入力されていません
例: 最初のフォームのアドレス -
http://'192.168.1.251'/update.php?Reference=654321
フィールドが完成していない後に更新をクリックした後 -
http://'192.168.1.251'/update.php?Reference=.
以下に問題があるページのコードを次に示します: (update_ac.php)
<?php
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);
//
while($rows=mysql_fetch_array($result)){
echo '<a href="update.php?Reference='.$rows['Reference'].' ">update test</a>';
}
//
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>";
//while($rows==mysql_fetch_array($result)){
echo "<a href='update.php?Reference={$rows['Reference']}.'>update</a>\n";
}
// end of while loop
else {
$sql = "UPDATE Triage SET completed='yes' WHERE Reference='$Reference'";
$result=mysql_query($sql);
echo "Successful";
echo "<BR>";
echo "<a href='list_records.php'>View result</a>";
}
?>