View Single Post
Old 06-01-2011, 10:34 PM   #8 (permalink)
destroyerx15
The Wanderer
 
Join Date: May 2011
Posts: 9
Thanks: 0
destroyerx15 is on a distinguished road
Default

i want to retrive the cheek box from db to another form to view

i write like this
my second form

<?php
include("config.php");

$orders = $_POST['checkbox'];
foreach($orders as $key=>$order) $orders[$key] = mysql_real_escape_string($order);
$orders = implode(', ', $orders);
$sql = "INSERT INTO orders (ORDER_DESC) VALUES ('$orders')";
mysql_query($sql) or die(mysql_error());
mysql_close($con)
?>

<table class="table" >
<form action="orders1.php" method="post">

<tr>
<th class="th"> ORDERING_DEPT </th>
</tr>
<tr>
<td class="td"> <input type="text" name="ORDERING_DEPT" /> </td>
</tr>

<tr>
<th class="th"> ORDERING_SERVICE </th>
</tr>
<tr>
<td class="td"> <input type="text" name="ORDERING_SERVICE" /> </td>
</tr>



<tr>
<td class="td"> <input type="text" name="ORDERING_DEPT" /> </td>
</tr>


<td class="td" ><input type="submit" value="Submit" name="Submit"/>
</td>
</tr>

</form>
</table>

and for insert :
<?php
include("config.php");

$result =mysql_query("SELECT ORDER_DESC FROM orders
WHERE ORDER_DESC = 'CSF','LFT'");

$sql="INSERT INTO orders (ORDERING_DEPT,ORDERING_SERVICE)
VALUES
('$_POST[ORDERING_DEPT]','$_POST[ORDERING_SERVICE]')";

echo "<table border='1'>
<tr>
<th>ORDER_DESC</th>
<th>ORDERING_DEPT</th>
<th>ORDERING_SERVICE</th>

</tr>";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['ORDER_DESC'] . "</td>";
echo "<td>" . $row['ORDERING_DEPT'] . "</td>";
echo "<td>" . $row['ORDERING_SERVICE'] . "</td>";
echo "</tr>";
}
echo "</table>";

it give me error for boolen
and when i want to insert the data only shown the cheekbx

can help
destroyerx15 is offline  
Reply With Quote