我一直尝试从Internet的不同线程尝试所有不同的想法,但是我似乎找不到任何想法,为什么我的表单将不提交或重置对数据所做的更改。该代码可以从数据库中提取数据,但是当我进行更改时,提交和重置按钮什么也不做。
//remove square braces from json string
$json_output = str_replace('[','',$json_output);
echo $json_output = str_replace(']','',$json_output);
表单的操作与此链接:
<?php
session_start();
//check session first
if (!isset($_SESSION['employee_id'])){
echo "You are not logged in!";
exit();
}else{
//include the header
include ("../includes/managerheader.php");
require_once ('../../mysqli_connect.php');
$customer_id=$_GET['customer_id'];
$query = "SELECT * FROM customers WHERE customer_id=$customer_id";
$result = @mysqli_query ($dbc, $query);
$num = mysqli_num_rows($result);
if ($num > 0) { // If it ran OK, display all the records.
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)){
?>
<form action="customerupdate2.php" method="post">
Customer ID: <input name="customer_id" size=50 value="<? echo $row['customer_id']; ?>"></br></br>
First Name: <input name="first_name" size=50 value="<? echo $row['first_name']; ?>"><p>
Last Name: <input name="last_name" size=50 value="<? echo $row['last_name']; ?>"><p>
Email Address: <input name="email" size=50 value="<? echo $row['email']; ?>"><p>
Password: <input name="password" size=50 value="<? echo $row['password']; ?>"><p>
Address: <input name="address" size=50 value="<? echo $row['address']; ?>"><p>
City: <input name="city" size=50 value="<? echo $row['city']; ?>"><p>
State: <input name="state" size=50 value="<? echo $row['state']; ?>"><p>
Zip: <input name="zip" size=50 value="<? echo $row['zip']; ?>"><p>
Telephone: <input name="telephone" size=50 value="<? echo $row['telephone']; ?>"><p>
Payment Type: <input name="payment_type" size=50 value="<? echo $row['payment_type']; ?>"><p>
Card Number: <input name="card_number" size=50 value="<? echo $row['card_number']; ?>"><p>
<input type="submit" value="update">
<input type="reset" value="reset">
<input type="hidden" name="customer_id" value="<? echo $row['customer_id']; ?>">
</form>
<?
} //end while statement
} //end if statement
mysqli_close($dbc);
//include the footer
include ("../includes/footer.php");
}
?>