Hey there! Thanks for the help, I'm going to post both my scripts so you can hopefully help me further. Basically I have a bugs_main.php and a bugs_main_edit.php, bugs_main.php displays the bugs within tables and a "status" column at the end which by default shows "Not yet taken". Now when you click an "edit" button, you're taken to a password screen, enter the password if correct the bugs_main_edit.php page loads, now this page shows all the bugs and also shows an input field plus two buttons in the "status" column, the input field takes the person's name and they then press one of the two buttons "fixed" or "working on", bugs_main.php takes that information and depending on which button is pressed, the corresponding text will display ("fixed" or "working on") along with the inputted name or whatever was input to the text field.
I hope you can understand that! :p
Here are the two scripts; I hope you or anyone can help me out!! I've tried a lot of different stuff, nothing's working yet :mad:. (I've obviously removed sensitive information from the following code!)
bugs_main.php:
<?php require("menu.php");
$ida = $id += 0;
//Connect to MYSQL server
mysql_connect("*removed*", "*removed*", "*removed*") or die(mysql_error());
//echo "<center><font color='white'>Successfully connected to MySQL!</font></center><br />";
//Connect to MYSQL database
mysql_select_db("*removed*") or die(mysql_error());
echo "<center><font color='white'><h4>Successfully connected to the Bugs Database!</h4></font></center>";
// Retrieve all the data from the table
$result = mysql_query("SELECT * FROM bugs ORDER BY ID DESC")
or die(mysql_error());
// store the record of table into $row
echo "<CENTER><TABLE BORDER='2' BORDERCOLOR='#336699' CELLPADDING='2' BGCOLOR='#000000' CELLSPACING='2' WIDTH='100%'></CENTER>";
echo "<tr> <th><font color='#FFFFFF'>ID</font></th> <th><font color='#FFFFFF'>Priority</font></th> <th><font color='#FFFFFF'>Bug Type</font></th> <th><font color='#FFFFFF'>Poster</font></th> <th><font color='#FFFFFF'>Bug Description</font></th> <th><font color='#FFFFFF'>Screenshot 1</font></th> <th><font color='#FFFFFF'>Screenshot 2</font></th> <th><font color='#FFFFFF'>Screenshot 3</font></th><th><font color='#FFFFFF'>Status</font></th></tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
echo "</td><td align='center'>";
echo "<font color='white'>".$ida++."</font>";
echo "</td><td align='center'>";
if($row['priority'] == Urgent)
echo "<strong><font color='#FF0000'>Urgent</font></strong>";
elseif($row['priority'] == Medium)
echo "<strong><font color='#FF6600'>Medium</font></strong>";
elseif($row['priority'] == Low)
echo "<strong><font color='#FFCC00'>Low</font></strong>";
echo "</td><td align='center'>";
echo "<font color='#FFFFFF'>".$row['type']."</font>";
echo "</td><td align='center'>";
echo "<font color='#FFFFFF'>".$row['poster']."</font>";
echo "</td><td align='center'>";
echo "<TEXTAREA wrap='hard' name='des' rows=5 cols=60 COLOR='#FFFFFF' readonly='yes' MAXLENGTH=9999>".$row['description']."</TEXTAREA>";
echo "</td><td align='center'>";
if(empty($row['screen1']))
echo "<font color='#FFFFFF'>No Screenshot submitted</font>";
else
echo "<A HREF=".$row['screen1']."><font color='#0099FF'>Screenshot1</font></A>";
echo "</td><td align='center'>";
if(empty($row['screen2']))
echo "<font color='#FFFFFF'>No Screenshot submitted</font>";
else
echo "<A HREF=".$row['screen2']."><font color='#0099FF'>Screenshot2</font></A>";
echo "</td><td align='center'>";
if(empty($row['screen3']))
echo "<font color='#FFFFFF'>No Screenshot submitted</font>";
else
echo "<A HREF=".$row['screen3']."><font color='#0099FF'>Screenshot3</A>";
echo "</td><td align='center'>";
if(isset($_POST['fixed']))
echo "<strong><font color='#009900'>Fixed by".$_POST['name']."!</font></strong>";
elseif(isset($_POST['working_on']))
echo "<strong><font color='#0033FF'>".$_POST['name']." is working on it!</font></strong>";
else
echo "<strong><font color='#FFCC00'>Not yet taken</font></strong>";
echo "</td></tr>";
}
echo "</TABLE>";
?></font></center></body></html>
bugs_main_edit.php:
<?php require("menu.php");
if($_POST['password'] != "password")
{ echo "<center><font color='red'><h4>Incorrect password!</h4></font></center>"; }
else
{
//Connect to MYSQL server
mysql_connect("*removed*", "*removed*", "*removed*") or die(mysql_error());
//echo "<center><font color='white'>Successfully connected to MySQL!</font></center><br />";
//Connect to MYSQL database
mysql_select_db("*removed*") or die(mysql_error());
echo "<center><font color='white'><h4>Successfully connected to the Bugs Database!</h4></font></center>";
//Retrieve all the data from the table
$result = mysql_query("SELECT * FROM bugs ORDER BY ID DESC")
or die(mysql_error());
//store the record of table into $row
echo "<CENTER><TABLE BORDER='2' BORDERCOLOR='#336699' CELLPADDING='2' BGCOLOR='#000000' CELLSPACING='2' WIDTH='100%'></CENTER>";
echo "<tr> <th><font color='#FFFFFF'>ID</font></th> <th><font color='#FFFFFF'>Priority</font></th> <th><font color='#FFFFFF'>Bug Type</font></th> <th><font color='#FFFFFF'>Poster</font></th> <th><font color='#FFFFFF'>Bug Description</font></th> <th><font color='#FFFFFF'>Screenshot 1</font></th> <th><font color='#FFFFFF'>Screenshot 2</font></th> <th><font color='#FFFFFF'>Screenshot 3</font></th><th><font color='#FFFFFF'>Update</font></th></tr>";
//keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result ))
{
// Print out the contents of each row into a table
echo "<tr><td align='center'>";
echo "<font color='white'>".$ida++."</font>";
echo "</td><td align='center'>";
if($row['priority'] == Urgent)
{echo "<strong><font color='#FF0000'>Urgent</font></strong>"; }
elseif($row['priority'] == Medium)
{ echo "<strong><font color='#FF6600'>Medium</font></strong>"; }
elseif($row['priority'] == Low)
{ echo "<strong><font color='#FFCC00'>Low</font></strong>"; }
echo "</td><td align='center'>";
echo "<font color='#FFFFFF'>".$row['type']."</font>";
echo "</td><td align='center'>";
echo "<font color='#FFFFFF'>".$row['poster']."</font>";
echo "</td><td align='center'>";
echo "<TEXTAREA wrap='hard' name='des' rows=3 cols=60 COLOR='#FFFFFF' readonly='yes'>".$row['description']."</TEXTAREA>";
echo "</td><td align='center'>";
if(empty($row['screen1']))
{ echo "<font color='#FFFFFF'>No Screenshot submitted</font>"; }
else
{ echo "<A HREF=".$row['screen1']."><font color='#0099FF'>Screenshot1</font></A>"; }
echo "</td><td align='center'>";
if(empty($row['screen2']))
{ echo "<font color='#FFFFFF'>No Screenshot submitted</font>"; }
else
{ echo "<A HREF=".$row['screen2']."><font color='#0099FF'>Screenshot2</font></A>"; }
echo "</td><td align='center'>";
if(empty($row['screen3']))
{ echo "<font color='#FFFFFF'>No Screenshot submitted</font>"; }
else
{ echo "<A HREF=".$row['screen3']."><font color='#0099FF'>Screenshot3</A>"; }
echo "</td><td align='center'>";
echo "<form method='POST' action='bugs_main.php'> <input type='text' value='Your name' name='name'></form>";
echo "<form method='POST' action='bugs_main.php'> <input type='submit' value='Fixed!' name='fixed'><br /></form>";
echo "<form method='POST' action='bugs_main.php'> <input type='submit' value='Working on' name='working_on'></form>";
echo "</td></tr>";
}
echo "</TABLE>";
echo "<center><form method='POST' action='bugs_main.php'><input type='submit' value='Save' name='save'></center>";
}
?></font></center></body></html>
Thanks!
-Brave.