私は PHP を初めて使用するので、単純な質問を許してください (質問の仕方や、どのキーワードを使用する必要があるのかさえわかりません)。
基本的に、データベース内のユーザーのデータを更新しようとしています。すべての顧客を一覧表示するための php があります (phpselect.php):
<html>
<body>
<?php
#
# Connect to the database
#
$conn=odbc_connect('database1','','');
if (!$conn)
{exit("Connection Failed: " . $conn);}
#
# SQL statements
#
$sql="SELECT * FROM customer";
$rs=odbc_exec($conn,$sql);
if (!$rs)
{exit("Error in SQL");}
#
# Make a table
#
echo "<table><tr>";
echo "<th>Action</th>";
echo "<th>Customer ID</th>";
echo "<th>Last Name</th>";
echo "<th>First Name</th>";
echo "<th>Middle Initial</th>";
echo "<th>Home Phone</th>";
echo "<th>Cell Phone</th>";
echo "<th>Date of Birth</th>";
echo "<th>Address</th>";
echo "<th>City</th>";
echo "<th>State</th>";
echo "<th>Zip Code</th>";
echo "<th>Employer</th>";
echo "<th>Referrer</th>";
echo "<th>Agent</th></tr>";
#
# Fetch records from SQL result-set
#
while (odbc_fetch_row($rs))
{
#
# Set field variables...
#
$cust_ID=odbc_result($rs,"cust_ID");
$cust_last=odbc_result($rs,"cust_last");
$cust_first=odbc_result($rs,"cust_first");
$cust_mi=odbc_result($rs,"cust_mi");
$home_phone=odbc_result($rs,"home_phone");
$cell_phone=odbc_result($rs,"cell_phone");
$DOB=odbc_result($rs,"DOB");
$street=odbc_result($rs,"street");
$city=odbc_result($rs,"city");
$state=odbc_result($rs,"state");
$zip_code=odbc_result($rs,"zip_code");
$employer=odbc_result($rs,"employer");
$referrer=odbc_result($rs,"referrer");
$agent_ID=odbc_result($rs,"agent_ID");
#
# ...and display them by variable name
#
echo "<tr>";
echo "<td>edit</td>";
echo "<td>$cust_ID</td>";
echo "<td>$cust_last</td>";
echo "<td>$cust_first</td>";
echo "<td>$cust_mi</td>";
echo "<td>$cust_last</td>";
echo "<td>$home_phone</td>";
echo "<td>$cell_phone</td>";
echo "<td>$DOB</td>";
echo "<td>$street</td>";
echo "<td>$city</td>";
echo "<td>$state</td>";
echo "<td>$zip_code</td>";
echo "<td>$employer</td>";
echo "<td>$referrer</td>";
echo "<td>$agent_ID</td></tr>";
}
#
# Close the connection to the database
#
odbc_close($conn);
#
# End the table
#
echo "</table>";
?>
</body>
</html>
...そして、フィールドを編集するために、(データベースから) ユーザーの情報をフォームのフィールドに送信するリンク (「更新」) を各行に追加しようとしています (phpinsert.php )。:
<html>
<body>
Enter Customer Information
<br>
(* indicates required fields)
<p>
<form action="phpinsert.php" method="post">
Last Name*: <input type="text" name="cust_last">
<br>
First Name*: <input type="text" name="cust_first">
<br>
Middle Initial: <input type="text" name="cust_mi">
<br>
Home Phone*: <input type="text" name="home_phone">
<br>
Cell Phone: <input type="text" name="cell_phone">
<br>
Date of Birth (mm/dd/yyyy)*: <input type="text" name="DOB">
<br>
Street Address: <input type="text" name="street">
<br>
City: <input type="text" name="city">
<br>
State: <input type="text" name="state">
<br>
Zip Code: <input type="text" name="zip_code">
<br>
Employer: <input type="text" name="employer">
<br>
Referrer: <input type="text" name="referrer">
<br>
<tr>
<td class="formLabel">Agent*:</td>
<td>
<select name="agent_ID" class="formEntry">
<option value="1">Guy Smiley</option></select>
</td>
</tr>
<br><br>
<input type="submit">
</form>
</body>
</html>
これを行う方法や正しく尋ねる方法がわかりませんか?
助けてくれてありがとう。