Hello,
First off...I am really new to Php and mySQL. I build this project database using online tutorials and a lot of trial and error. But now I am stuck at what i think should be an easy task. I got the entire database working. It populates html tables the way I want it to. I have been able to write a script that populates a dropdown box with the project names. The user can then select one and it moves on to this script where the user can edit the database record.
whiteboard_showmodrecord.php
<?
$conn =
$db =
$sql = "SELECT * FROM PROJECT_LIST WHERE ID = '$_POST[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']);
$responder = stripslashes($record['RESPONDER']);
$request_date = stripslashes($record['REQUEST_DATE']);
$response_date = stripslashes($record['RESPONSE_DATE']);
$dev = stripslashes($record['REQ_DELIVERY_DATE']);
$scope = stripslashes($record['SCOPE']);
$support = stripslashes($record['SUPPORT_NEEDED']);
$est = stripslashes($record['DEVEL_EST']);
$planned_start = stripslashes($record['PLANNED_START']);
$actual_start = stripslashes($record['ACTUAL_START']);
$planned_complete = stripslashes($record['PLANNED_COMPLETE']);
$actual_complete = stripslashes($record['ACTUAL_COMPLETE']);
$status = stripslashes($record['STATUS']);
}
echo "<HTML>
<HEAD>
<TITLE>Modify Project</TITLE>
</HEAD>
<BODY>
<h1>Modify this project</h1>
<FORM method=\"POST\" action=\"whiteboard_domodrecord.php\">
<INPUT TYPE=\"hidden\" name=\"id\" value=\"$id\">
<P><strong>Project Name</strong>
<INPUT type=\"text\" name=\"project_name\" value=\"$project_name\"
size=100 maxlength=100>
<P><strong>Project Category</strong>
<INPUT type=\"text\" name=\"category\" value=\"$category\" size=20 maxlength=15>
<P><strong>Customer:</strong> <INPUT type=\"text\" name=\"customer\" value=\"$customer\" size=25 maxlength=25>
<P><strong>Requestor:</strong> <INPUT type=\"text\" name=\"requestor\" value=\"$requestor\" size=25 maxlength=25>
<P><strong>Request Date (yyyy-mm-dd):</strong> <INPUT type=\"text\" name=\"request_date\" value=\"$request_date\" size=12 maxlength=12>
<P><strong>Response Date (yyyy-mm-dd):</strong> <INPUT type=\"text\" name=\"response_date\" value=\"$response_date\" size=12 maxlength=12>
<P><strong>Responder:</strong> <INPUT type=\"text\" name=\"responder\" value=\"$responder\" size=25 maxlength=25>
<P><strong>Requested Delivery Date (yyyy-mm-dd):</strong> <INPUT type=\"text\" name=\"dev\" value=\"$dev\" size=15 maxlength=15><br>
<P><strong>Project Scope:</strong><br>
<TEXTAREA name=\"scope\" cols=35 rows=7>$scope</TEXTAREA>
<P><strong>Support Needed?:</strong> <INPUT type=\"text\" name=\"support\" value=\"$support\" size=5 maxlength=5>
<P><strong>Development Estimate:</strong> <INPUT type=\"text\" name=\"est\" value=\"$est\" 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>Actual Start Date (yyyy-mm-dd):</strong> <INPUT type=\"text\" name=\"actual_start\" value=\"$actual_start\" size=15 maxlength=15><br>
<P><strong>Planned Completion Date (yyyy-mm-dd):</strong> <INPUT type=\"text\" name=\"planned_complete\" value=\"$planned_complete\" size=15 maxlength=15><br>
<P><strong>Actual Completion Date (yyyy-mm-dd):</strong> <INPUT type=\"text\" name=\"actual_complete\" value=\"$actual_complete\" size=15 maxlength=15><br>
<P><strong>Project Status:</strong> <INPUT type=\"text\" name=\"status\" value=\"$status\" size=30 maxlength=30><br>
<p align=center><INPUT type=\"submit\" value=\"Modify Project\"></p>
</FORM>
</BODY>
</HTML>";
}
?>
And all of this works great but its not as user friendly as I want it to be. What I want to be able to do is allow user be able to click on the project's name from the table in the "spdefault.php" script below and it will take them to the "whiteboard_showmodrecord.php" above.
<%
include "functions.php";
%>
<html>
<head>
<title>SU Project Database</title>
<meta name="keywords" content="mitch">
<LINK href="cssstyle.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-image: url(images/sm3.gif);
}
</head>
<body bgcolor="#000000" topmargin="0">
<p> </p>
<div align="center" style="margin:10px 0 10px 0;">
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:750px;background-color:#FFFFFF;border-bottom:1px solid #FF9A00;">
<tr>
<td><div style="float:left;padding:20px 0 10px 20px;text-align:left;vertical-align:top;"><br />
</div>
<div style="float:right;padding:10px;text-align:right;vertical-align:top;">
<div class="orange" style="margin-bottom:5px;"> <span class="bt style1">Database </span><br />
</div>
<div style="margin-bottom:5px;">
</div>
beta v.05 </div></td>
</tr>
</table>
<div style="width:750px;text-align:center;background-color:#EFEFEF;">
<div style="padding:5px 0 5px 0;border-bottom:1px solid #FF9A00;">
<div align="left">
<p><img src="images/spacer.gif" width="10" height="10" /><a href="requestform.php" class="bt">Request Form</a></p>
<p><img src="images/spacer.gif" width="10" height="10" /><a href="whiteboard_modrecord.php" class="bt">Update Projects </a></p>
<p><img src="images/spacer.gif" width="10" height="10" /><a href="csvproject_list.php" class="bt">Export Project Database to Excel </a></p>
</div>
</div>
<div style="padding:10px;text-align:left;">
<div style="margin-bottom:4px;">
<%
%>
</table></td>
</tr>
</table>
<p></p>
<table width="780px" align="center" cellpadding="2" cellspacing="0" bgcolor="#FF9900">
<tr>
<td><table border="0" cellpadding="0" bgcolor="#ffffff" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" id="AutoNumber1" width="100%">
<tr>
<td colspan="6" class="goldline"><img src="images/spacers.gif" width="1" height="1"></td>
</tr>
<tr class="ro">
<td colspan="6" class="ro style2"> </td>
</tr>
<tr class="ro">
<td align="center" class="listlabel style2"> </td>
<td class="listlabel"><b class="bt">Project Name </b></td>
<td class="listlabel style2"> </td>
<td class="listlabel"><b class="bt">Category</b></td>
<td class="listlabel style2"> </td>
<td class="listlabel"><b class="bt">Project Status </b></td>
</tr>
<tr class="ro">
<td colspan="6" class="baseline"><img src="images/spacer.gif" width="1" height="1"></td>
</tr>
<%
$sfield = "PROJECT_NAME";
$sdir = "ASC";
$sql = "SELECT STATUS, CATEGORY, PROJECT_NAME FROM PROJECT_LIST ORDER BY $sfield $sdir";
$result = execSQL($sql);
while (list($xstatus,$xcategory,$xproject_name) = mysql_fetch_array($result)) {
$bgcolor = switchBG($bgcolor);
%>
<tr class="ro">
<td align="center" class="listdata style2" <%=$bgcolor%>> </td>
<td <%=$bgcolor%> class="listdata"><span class="style2"><%=$xproject_name%></span></td>
<td <%=$bgcolor%> class="listdata"><img src="images/spacer.gif" width="10" height="10"></td>
<td <%=$bgcolor%> class="listdata"><span class="style2"><%=$xcategory%></span></td>
<td <%=$bgcolor%> class="listdata"><img src="images/spacer.gif" width="10" height="10"></td>
<td <%=$bgcolor%> class="listdata"><span class="style2"><%=$xstatus%></span></td>
</tr>
<%
}
%>
<tr>
<td colspan="6" class="baseline"><img src="images/blank.gif" width="1" height="1"></td>
</tr>
</table></td>
</tr>
</table>
</div>
<div style="margin-bottom:10px;"></div>
</div>
</div>
<div align="center">
<table cellpadding="0" cellspacing="0" border="0" align="center" style="width:750px;margin:5px 0 10px 0;">
<tr>
<td><div style="float:left;color:#FFFFFF;"> <b><span class="a1"></span></b> </div></td>
</tr>
</table>
</div>
</div>
</body>
</html>
Is that possible to do. I can't figure out how to do it. I have also tried to put a radio button by the name of each item in the table and have an submit button but I couldn't get the code correct for that either. Please help if you can.
Thank you in advance!
-Mitch