Welcome to WebmasterWorld Guest from 54.81.166.196
<?php
// Get results from table
$result = mysql_query("SELECT * FROM $tbl_name")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>ID</th> <th>First Name</th> <th>Surname</th> <th>Address1</th> <th>Address2</th> <th>Town/City</th> <th>County</th> <th>Post Code</th> <th>Request Date</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>";
echo $row['request'];
echo "</td><td>";
echo $row['firstname'];
echo "</td><td>";
echo $row['surname'];
echo "</td><td>";
echo $row['address1'];
echo "</td><td>";
echo $row['address2'];
echo "</td><td>";
echo $row['town'];
echo "</td><td>";
echo $row['county'];
echo "</td><td>";
echo $row['postcode'];
echo "</td><td>";
echo $row['date'];
echo "</td></tr>";
}
echo "</table>";
$num_rows = mysql_num_rows($result);
echo "$num_rows samples are awaiting shipment.<br>";
echo "Updated on: ";
echo date("l, F d, T h:i" ,time());
echo "<br>";
?>
SELECT * FROM $tbl_name WHERE sent <> 'Yes' ;
$sent=strtoupper(No);
so that there could be no confusion with typing. each box would have to be somehow directly linked to the record it needs to update :-s
When the entry is made into the database I have told the form to input the 'sent' field with $sent=strtoupper(No); so that there could be no confusion with typing.
<h1>Pending Sample Requests</h1>
<?php
// Get results from table
$result = mysql_query("SELECT * FROM $tbl_name WHERE sent=0")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>ID</th> <th>First Name</th> <th>Surname</th> <th>Address1</th> <th>Address2</th> <th>Town/City</th> <th>County</th> <th>Post Code</th> <th>Request Date</th> <th>Sent</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>";
echo $row['request'];
echo "</td><td>";
echo $row['firstname'];
echo "</td><td>";
echo $row['surname'];
echo "</td><td>";
echo $row['address1'];
echo "</td><td>";
echo $row['address2'];
echo "</td><td>";
echo $row['town'];
echo "</td><td>";
echo $row['county'];
echo "</td><td>";
echo $row['postcode'];
echo "</td><td>";
echo $row['date'];
echo "</td><td>";
echo "<input type='checkbox' name='update' value='1'>";
echo "</td></tr>";
}
echo "</table>";
echo "<input type='button' name='submit' value='Submit'>";
function update()
{
if (isset($_POST['Submit']) && $_POST['Submit'] == 'Submit')
{
$update=($_POST['update']);
$sql = mysql_query("UPDATE $tbl_name SET sent = 1 WHERE ". $update ." = 1");
}
}
echo "<br>";
$num_rows = mysql_num_rows($result);
echo "$num_rows samples are awaiting shipment.<br>";
echo "Updated on: ".date("l, F d, T h:i" ,time());
echo "<br>";
?>
<?php
// Get results from table
$result = mysql_query("SELECT * FROM $tbl_name WHERE sent=0")
or die(mysql_error());
echo "<table border='1'>";
echo "<tr> <th>ID</th> <th>First Name</th> <th>Surname</th> <th>Address1</th> <th>Address2</th> <th>Town/City</th> <th>County</th> <th>Post Code</th> <th>Request Date</th> <th>Sent</th> <th>Print</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>";
echo $row['request'];
echo "</td><td>";
echo $row['firstname'];
echo "</td><td>";
echo $row['surname'];
echo "</td><td>";
echo $row['address1'];
echo "</td><td>";
echo $row['address2'];
echo "</td><td>";
echo $row['town'];
echo "</td><td>";
echo $row['county'];
echo "</td><td>";
echo $row['postcode'];
echo "</td><td>";
echo $row['date'];
echo "</td><td>";
echo "<input type='checkbox' name='update' value='". $request ."'>";
echo "</td><td>";
echo "<input type='checkbox' name='print' value=''>";
echo "</td></tr>";
}
echo "</table>";
echo "<input type='button' name='Submit' value='Submit'>";
function update()
{
if (isset($_POST['Submit']) && $_POST['Submit'] == 'Submit')
{
$update=($_POST['update']);
$sql = mysql_query("UPDATE $tbl_name SET sent = 1 WHERE ". $update ." = ". $request ." ");
}
}
function update()
{
if (isset($_POST['Submit']) && $_POST['Submit'] == 'Submit')
{
$update = ($_POST['update']);
$request = ($row['request']);
$sql = mysql_query("UPDATE sample_requests SET sent = 1 WHERE ". $request ." = ". $update ." ");
}
}