Trying to add a checkbox to an echo string... argh help
Posted: Mon Feb 22, 2010 4:52 pm
Hello Im really sorry i need help
Im trying to put a checkbox in a returned query from a database i.e echo row with a ceckbox so i can delete the row...
Its just not working, tried messing aroun with the parms and nothing works
below is the code could someone please help its driving me insaine!!
Im trying to put a checkbox in a returned query from a database i.e echo row with a ceckbox so i can delete the row...
Its just not working, tried messing aroun with the parms and nothing works
below is the code could someone please help its driving me insaine!!
Code: Select all
<?php
// Start the session
require_once('startsession.php');
// Insert the page header
$page_title = 'Inbox';
require_once('header.php');
// ========== SCOTT ==============
//Include the connection details, open $connection and select database
//include ("connection.php");
require_once('connectvars.php');
//vars
$user_id = $_SESSION['user_id'];
echo $user_id;
//Prepare query
$query = "SELECT * FROM MESSAGES WHERE MessageTo='$user_id' ";
// execute query
$result = mysqli_query($dbc,$query) or die ("Error in query: $query. ".mysql_error());
// see if any rows were returned
if (mysqli_num_rows($result)>0) {
echo "<table border=1>\n<tr>" .
"<th>MessageNo</th>" .
"<th>MessageFrom</th>" .
"<th>MessageTo</th>" .
"<th>Subject</th>" .
"<th>Message</th>".
"<th>Reply</th>".
"<th>Delete</th>";
while ($row = @ mysqli_fetch_array($result)) {
//while($row = mysql_fetch_row($result)) {
echo "<tr>";
echo "<td >".$row["MessageNo"]."</td>";
echo "<td>".$row["MessageFrom"]."</td>";
echo "<td>".$row["MessageTo"]."</td>";
echo "<td>".$row["Subject"]."</td>";
echo "<td>".$row["Message"]."</td>";
echo "<input type=\"checkbox\" name=\"delete[]\" value=\"$row['MessageNo']\" />";
echo "<td class=BorderMeRed>".$row["MessageNo"]."</td>";
echo "</tr>";
}
echo "</table>";
}
else {
// no
// print status message
print "No rows found!";
}
?>
<?php
// Include the formatted error message
/* if (isset($_SESSION['message']))
echo
"<h3><font color=red>".$_SESSION['message']."</font></h3>"; */
?>
<p>Click<a href="tester.php">Here</a>to send a message<p/>
<?php
require_once('footer.php');
?>