Can anyone tell me what is wrong with this code? I wrote it a while ago and it used to work fine. Then I modified it last week and can't find what error I made when I modified it. The first page populates the text areas from the datebase fine but when I type my updates and hit submit, I just get a blank screen for the whiteboard_domodrecord.php page and it doesn't update the datebase. It must be something simple that I just can't see since I have been looking at it for too long.
Thanks for any help in advance, it is much appreciated!!!
<?
$passed_vars = array_merge($_POST,$_GET);
$sql = "SELECT * FROM PROJECT_LIST WHERE ID = '$passed_vars[sel_record]'";
$sql_result = mysql_query($sql) or die (mysql_error());
if (!$sql_result) {
echo "Something has gone wrong!";
} else {
while ($record = mysql_fetch_array($sql_result)) {
$id = $record['ID'];
$project_name = stripslashes($record['PROJECT_NAME']);
$category = stripslashes($record['CATEGORY']);
$customer = stripslashes($record['CUSTOMER']);
$requestor = stripslashes($record['REQUESTOR']);
$request_date = stripslashes($record['REQUEST_DATE']);
$dev = stripslashes($record['REQ_DELIVERY_DATE']);
$scope = stripslashes($record['SCOPE']);
$planned_start = stripslashes($record['PLANNED_START']);
$status = stripslashes($record['STATUS']);
}
echo "
<FORM method=\"POST\" action=\"whiteboard_domodrecord.php\">
<INPUT TYPE=\"hidden\" name=\"id\" value=\"$id\">
<p align=center><INPUT type=\"submit\" value=\"Modify Project\"></p>
<P><strong>Project Name</strong>
<INPUT type=\"text\" name=\"project_name\" value=\"$project_name\"
size=100 maxlength=100>
<P><strong>Project Status</strong>
<SELECT name=\"category\">
<OPTION value=\"\">-- Select One --</OPTION>";
$cat_array = array("Requested", "Active", "Complete", "Cancelled");
foreach ($cat_array as $cat) {
if ($cat == "$category") {
echo "<OPTION value=\"$cat\" selected>$cat</OPTION>";
} else {
echo "<OPTION value=\"$cat\">$cat</OPTION>";
}
}
echo "</SELECT>
<P><strong>Customer:</strong>
<SELECT name=\"customer\">
<OPTION value=\"\">-- Select One --</OPTION>";
$cat1_array = array("TSFC", "SCBNA", "SFM", "FS", "HS", "SHARED", "OTHER");
foreach ($cat1_array as $cat1) {
if ($cat1 == "$customer") {
echo "<OPTION value=\"$cat1\" selected>$cat1</OPTION>";
} else {
echo "<OPTION value=\"$cat1\">$cat1</OPTION>";
}
}
echo "</SELECT>
<P><strong>Requestor:</strong> <INPUT type=\"text\" name=\"requestor\" value=\"$requestor\" size=25 maxlength=25>
<P><strong>Decision:</strong> <INPUT type=\"text\" name=\"status\" value=\"$status\" size=80 maxlength=5000>
<P><strong>Request Date (yyyy-mm-dd):</strong> <INPUT type=\"text\" name=\"request_date\" value=\"$request_date\" size=12 maxlength=12>
<P><strong>Requested Delivery Date (yyyy-mm-dd):</strong> <INPUT type=\"text\" name=\"dev\" value=\"$dev\" size=15 maxlength=15><br>
<P><strong>Planned Start Date (yyyy-mm-dd):</strong> <INPUT type=\"text\" name=\"planned_start\" value=\"$planned_start\" size=15 maxlength=15><br>
<P><strong>Notes:</strong><br>
<TEXTAREA name=\"scope\" cols=70 rows=8>$scope</TEXTAREA>
<p align=center><INPUT type=\"submit\" value=\"Modify Project\"></p>
</FORM>
";
}
?>
whiteboard_domodrecord.php
<?
$conn = mysql_connect("127.0.0.1","_left out on purpose_","_ditto_") or die(mysql_error());
$db = mysql_select_db("maindb", $conn) or die(mysql_error());
$DB[project_name]=addslashes([project_name]);
$DB[category]=addslashes($_POST[category]);
$DB[customer]=addslashes($_POST[customer]);
$DB[request_date]=addslashes($_POST[request_date]);
$DB[scope]=addslashes($_POST[scope]);
$DB[requestor]=addslashes($_POST[requestor]);
$DB[dev]=addslashes($_POST[dev]);
$DB[planned_start]=addslashes($_POST[planned_start]);
$DB[status]=addslashes($_POST[status]);
$DB[id] = $_POST[id];
$sql = "UPDATE PROJECT_LIST
SET PROJECT_NAME = '$DB[project_name]',
CATEGORY = '$DB[category]',
CUSTOMER = '$DB[customer]',
REQUEST_DATE = '$DB[request_date]',
SCOPE = '$DB[scope]',
REQUESTOR = '$DB[requestor]',
REQ_DELIVERY_DATE = '$DB[dev]',
PLANNED_START = '$DB[planned_start]',
STATUS = '$DB[status]'
WHERE ID = '$DB[id]'";
$result = mysql_query($sql) or die (mysql_error());
if (isset($result)) {
echo "<HTML>
<HEAD>
<TITLE>Modify a Project</TITLE>
</HEAD>
<BODY>
<h1>The new record looks like this:</h1>
<P><strong>Project Name:</strong> ".stripslashes($_POST['project_name'])."
<P><strong>Category:</strong> ".stripslashes($_POST['category'])."
<P><strong>Requestor:</strong> ".stripslashes($_POST['requestor'])."
<P><strong>Customer:</strong> ".stripslashes($_POST['customer'])."
<P><strong>Request Date:</strong> ".stripslashes($_POST['request_date'])."
<P><strong>Requested Develivery Date:</strong> ".stripslashes($_POST['dev'])."
<P><strong>Planned Start:</strong> ".stripslashes($_POST['planned_start'])."
<P><strong>Status:</strong> ".stripslashes($_POST['status'])."
<P><strong>Scope:</strong> ".stripslashes($_POST['scope'])."
<P align=center><a href=\"default.htm\">Return to Menu</a></p>
</BODY>
</HTML>";
} else {
echo "Some sort of error has occurred.</p>";
}
?>