0

我有一个通过服务器端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";}
     ?>

这两个测试文件在我的数据库上运行良好,而且似乎因为我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>
        &nbsp;
         <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>';     
4

1 回答 1

0

您没有发布q5_address5[addr_line1]Update.php

于 2013-09-27T08:10:53.650 回答