I have 3 functions
1 select a record from a drop down list
2 display the record and modify elements of it
3 Issue a modify
Yes I know its a hifalluting way of modifying a record.
My code seems to work in 1 get a record from the file
but it wont do anything in 2 (wont display record for modification
Code is as follows
Code: Select all
<?php
//
// This function modifies Petaluma Schedule entries
//
include 'config.php';
include 'opendb.php';
// access existing Petaluma records
$sql = "SELECT date1, date2, date3 FROM petaluma";
$sql_result = mysql_query($sql, $conn) or die ("zero-connection to Database files");
if (!$sql_result) {
echo "Problem with petaluma file in amend function";
} else {
echo "
<html>
<head>
<title>PETALUMA SCHUDLE MODIFICATION</title>
</head>
<body>
<center>
<font face=arial>
<h3> Select a date from the list already available on File</h3>
<FORM method=\"POST\" action=\"petaa.php\">
<table cellspacing=5 cellpadding=5>
<tr>
<td align=left><strong>Petaluma Dates</strong></td>
<td valign=top>
<select name=\"sel_record\">
<option value=\"\">Select date--</option>
";
while ($row=mysql_fetch_array($sql_result)) {
$date1 = $row["date1"];
$date2 = $row["date2"];
$date3 = $row["date3"];
echo "
<option value=\"$date1\">$date1 : $date2 : $date3 </option>
";
}
echo "
</select>
</td>
</tr>
<tr><td colspan=2 align=center><INPUT type=\"submit\" value=\"Fetch Date\"></td>
</tr>
</table>
</FORM>
</body>
</html>
";
}
// mysql_close($conn);
?>Code: Select all
<?php
// This function called from PETA.PHP
// This function will modify Petaluma Schedule entry selected in PETA
// passes control to PETAAA to finish the job
include 'config.php';
include 'opendb.php';
// access existing Petaluma records
$sql = "SELECT date1, date2, date3, comment, status FROM petaluma WHERE date1 = \"$sel_record\"";
$sql_result = mysql_query($sql, $conn) or die ("zero-connection to Database file");
if (!$sql_result) {
echo "Problem with petaluma file in amend function";
} else {
$row = mysql_fetch_array($sql_result);
$dd1 = $row["date1"];
$dd2 = $row["date2"];
$dd3 = $row["date3"];
$cmt = $row["comment"];
$dlt = $row["delete"];
$sts = $row["status"];
echo "
<html>
<head>
<title>PETALUMA SCHEDULE MODIFICATION</title>
</head>
<body>
<center>
<font face=arial>
<h3> Modify the record.</h3>
<FORM method=\"POST\" action=\"petaaa.php\">
\\ <input type=\"hidden\" name=\"sel_record\" value=\"$date1\">
<table cellspacing=5 cellpadding=5>
<tr><td><strong> Course Start Date : </strong></td> <td> \"$dd1\"</td></tr>
<tr><td><strong> Date 2 </strong></td> <td> \"$dd2\"</td></tr>
<tr><td><strong> Date 3 </strong></td> <td> \"$dd3\"</td></tr>
<tr><td colspan=2><strong> <hr size=1></td></tr>
<tr>
<td><strong> Status : </strong> </td>
<td>
<SELECT name=\"status\">
<OPTION value=\"\"> </OPTION>
<option value="Course Full">Full</option>
<option value="Course Open">Open</option>
<option value="Delete">Delete</option>
</SELECT>
</td></tr>
<tr><td><strong> Comment : </strong></td><td> <INPUT type=\"text\" name=\"cmt"\ value=\"$cmt\" size=80></td><tr>
<tr><td colspan=2><INPUT type=\"submit\" value=\"Modify Course\"></td></tr>
</table>
</FORM>
</body>
</html>
";
}
mysql_close($conn);
?>