サーバーサイドphp
ファイルを介して入力されるフォームがあり、これはレコードのすべてのフィールドとデータをエコーしますMYSQL
echo '<li class="form-line" id="id_21"><label class="form-label-left" id="label_21" for="input_21"> Customer Job Details </label><div id="cid_21" class="form-input">';
echo '<table>';
echo '<tr>';
echo '<td><label class="form-sub-label" for="first_3" id="sublabel_first"> Customers Name </label><input type="text" id="CustomerName" value="' . $rows['CustomerName'] . '"></td>';
echo '<td><label class="form-sub-label" for="first_3" id="sublabel_first"> Signing Date </label><input type="text" id="SignDate" value="' . $rows['SignDate'] . '"></td>';
echo '<td><label class="form-sub-label" for="first_3" id="sublabel_first"> OrderNumber </label><input type="text" name="OrderNumber" id="OrderNumber" value="' . $rows['OrderNumber'] . '"></td>';
echo '</tr>';
echo '<tr>';
echo '<td><label class="form-sub-label" for="first_3" id="sublabel_first"> Current Account Status </label><input type="text" id="CustomerStatus" value="' . $rows['CustomerStatus'] . '"></td>';
echo '<td><label class="form-sub-label" for="first_3" id="sublabel_first"> Customer Last Updated </label><input type="text" class=" form-textbox" data-type="input-textbox" id="input_21" name="CustomerLastUpdate" size="20" value="' . $rows['LastUpdated'] . '" /></td>';
echo '<td><label class="form-sub-label" for="first_3" id="sublabel_first"> Contact Email </label><input type="text" id="OrderNumber" name="Email" size="25" value="' . $rows['Email'] . '"></td>';
echo '</tr>';
echo '</table>';
echo '<li class="form-line" id="id_4"><label class="form-label-left" id="label_4" for="input_4"> Company Name </label><div id="cid_4" class="form-input">';
echo '<label class="form-sub-label" for="first_3" id="sublabel_first"> Company Name </label><input type="text" class=" form-textbox" data-type="input-textbox" id="input_4" name="q4_companyName4" size="40" value="' . $rows['CompanyName'] . '" />';
echo '</div>';
echo '</li>';
echo '<li class="form-line" id="id_5">
<label class="form-label-left" id="label_5" for="input_5"> Address </label>
更新する小さなテストファイルを作成しました.....Update.html
<html>
<form method="post" name="update" action="Update.php" />
Address1:
<input type="text" name="Address1" />
OrderNumber:
<input type="text" name="OrderNumber" />
<input type="submit" name="Submit" value="update" />
</form>
というサーバー側ファイルもありますUpdate.php
or die("Could not select examples");
$Add1 = $_POST["q5_address5[addr_line1]"];
$Add2 = $_POST["Address1"];
$Order = $_POST['OrderNumber'];
$query = "UPDATE CurrentJobs SET StreetAddress = '$Add1' WHERE OrderNumber = '$Order'";
if(mysql_query($query)){
echo "updated '$Add1''$Add2' Value";}
else{
echo "fail";}
?>
これら 2 つのテスト ファイルは、私のデータベースではうまく機能していますがecho
、サーバー側のファイルからデータを取得しているため、正しく更新されていないようです。echo
値を入力する$Add1
と空になり、フィールドに手動で配置したデータもクリアされるため、「」が返されているようです
私が間違っていることを提案していただければ幸いです。
私はHTMLフォームにPOSTメソッドを配置しました
<form class="xxxxxx" action="Update.php" method="post" name="update" id="UpdateFrorm" accept-charset="utf-8">
<button id="input_2" type="submit" class="form-submit-button form-submit-button-metal_brushed">
Submit
</button>
私はまた、phpファイルに更新ボタンを配置しようとしましたが、それでも喜びはありません...
echo '<div style="text-align:center" class="form-buttons-wrapper">
<form class="xxxxxxx" action="Update.php" method="post" name="update" id="UpdateFrorm" accept-charset="utf-8">
<button id="input_2" type="submit" class="form-submit-button form-submit-button-metal_brushed">
Submit
</button>
<button id="input_print_2" style="margin-left:25px;" class="form-submit-print form-submit-button-metal_brushed" type="button">
<img src="http://cdn.jotfor.ms/images/printer.png" align="absmiddle" />
Print Form
</button>
<INPUT TYPE="Submit" VALUE="Update the Record" NAME="Submit">
</div>';