Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 表单更新-不工作_Php_Html_Mysql_Mysqli - Fatal编程技术网

Php 表单更新-不工作

Php 表单更新-不工作,php,html,mysql,mysqli,Php,Html,Mysql,Mysqli,全部, 我正在从过时的mysql\u查询迁移到mysqli,在此过程中,我遇到了一些表单更新更改方面的问题。具体来说,获取id的$ud\u id变量似乎不起作用 查询被写入左侧外部联接链接表empinfo和headcount,其中这两个表都包含链接主id 以下是edit.php页面,该页面按预期工作和加载: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/

全部,

我正在从过时的
mysql\u查询
迁移到
mysqli
,在此过程中,我遇到了一些表单更新更改方面的问题。具体来说,获取
id
$ud\u id
变量似乎不起作用

查询被写入左侧外部联接链接表
empinfo
headcount
,其中这两个表都包含链接主id

以下是edit.php页面,该页面按预期工作和加载:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


<div class="header">
<?php include 'header.php';?>
</div>

<center>

<?php
    // db connection
    include_once('../connection.php');

        // id pull from url
        $ID = (int)$_GET['id'];
            // get results from database
            $query = "SELECT headcount.*, empinfo.*
            FROM headcount
            LEFT OUTER JOIN empinfo
            ON headcount.id = empinfo.id
            WHERE headcount.id = '$ID'";

            $response = mysqli_query($dbc, $query);

            while($row = mysqli_fetch_array($response))

            {

                echo "<form action='update.php' method='post'>";
                echo '<div style="width:40%;padding:0 10pt 0 0;float:middle;">';
                if ($row['isActive'] === '1')
                echo '<input type="checkbox" name="ud_isActive" value="1" checked>Active<br />';
                else
                echo '<input type="checkbox" name="ud_isActive" value="0">Active<br />';
                echo '<input type="hidden" name="ud_ID" value="<?=$ID;?>">';
                echo "ID #: <input type='text' name='ud_hwid' value=". $row['id'] ." disabled readonly><br />";
                echo 'Name: <input type="text" name="ud_EmployeeName" value="'. $row["EmployeeName"] .'"><br />';
                echo '<br />';
                echo '<a href="mailto:' . $row["Email"] .'">Email</a>: <input type="text" name="ud_Email" value="'. $row["Email"] .'"><br>';
                echo '<br />';
                echo 'DOB: <input type="text" name="ud_DOB" value='. $row["DOB"] .'><br />';
                echo 'Age: <input type="text" name="ud_Age" value='. $row["Age"] .'><br />';
                if ($row['isUnderage'] === '1')
                echo '<input type="checkbox" name="isUnderage" value="1" checked>Underage<br />';
                else
                echo '<input type="checkbox" name="isUnderage" value="0">Underage<br />';
                echo '</div>';
                echo '<div style="width:40%;padding:0 10pt 0 0;float:middle;">';
                echo '<br />';
                echo 'Address: <input type="text" name="ud_StreetAddress" value="'. $row["StreetAddress"] .'"><br />';
                echo 'City: <input type="text" name="ud_City" value="'. $row["City"] .'"><br />';
                echo 'Zip Code: <input type="text" name="ud_ZipCode" value="'. $row["ZipCode"] .'"><br />';
                echo '<br />';
                echo 'Home Phone: <input type="text" name="ud_HomePhone" value="'. $row["HomePhone"] .'"><br />';
                echo 'Wireless: <input type="text" name="ud_Wireless" value="'. $row["Wireless"] .'"><br />';
                echo '<br />';
                echo 'Home Department: <input type="text" name="ud_HomeDept" value="'. $row["HomeDept"] .'"><br />';
                echo 'Department Manager: <input type="text" name="ud_Manager" value="'. $row["Manager"] .'"><br />';
                echo '</div>';
                echo '<br />';
                echo 'Live Orientation:<input type="date" name="LODate" value=""><br />';
                echo '<br />';
                echo 'Online Training: <input type="date" name="OTTraining" value=""><br />';



          }

    ?>
    <br />

    <input type="Submit">
    </form> <br />
      <a href="javascript:history.back()">Go Back</a>
    <br />
    </body>
    </html>
我没有结果

此外,在edit.php上,我尝试了:

echo '<input type="hidden" name="ud_ID" value='. $row["id"] .'><br />';

单击“提交”按钮时,我收到一条消息,说明记录已更新,但在刷新时,记录具有相同的数据。

Hi use name属性可获取值

$ud_ID = $_POST['ud_ID'];

谢谢你,曼塔。工作得很好。
echo '<input type="hidden" name="ud_ID" value='. $row["id"] .'><br />';
Notice: Undefined index: ID in update.php on line 27
$ud_ID = $_POST['ud_ID'];