I have a inserts products page, and a products page. All the items inputted into the insert product page is automatically showcased on the products page. How do i stop that. I have a checkbox, on check i want the item to show and when unchecked to disappear on the product page. The checkbox is located on the insert products page.
INSERT PRODUCT PAGE
<input type="checkbox" name="act_check" id="act_check" class="check" onclick="showMe('section_left')" value=""><p class="ppc"> Display in search results</p>
'section_left' is a div that holds the form.
function showMe(box) {
var chboxs = document.getElementsByName("act_check");
var vis = "none";
for (var i = 0; i < chboxs.length; i++) {
if (chboxs[i].checked) {
vis = "block";
break;
}
}
document.getElementById(box).style.display = vis;
}
I am a little confused how to target the products page.
PRODUCTS PAGE
<div id="products_view">
<?php
$select_prods = "SELECT * FROM Rest_Details";
$run_prods = mysqli_query($dbc, $select_prods);
//$run_prods = mysqli_prepare($dbc, $select_prods) or die(mysqli_error($dbc));
// $runn = mysqli_stmt_execute($run_prods);
while ($row_prods = mysqli_fetch_array($run_prods)) {
$rest_id = $row_prods['Resturant_ID'];
$rest_name = $row_prods['Resturant_name'];
$rest_add = $row_prods['Res_Address_Line_1'];
$rest_city = $row_prods['City_name'];
$rest_cat = $row_prods['Cat_ID'];
$rest_avg = $row_prods['Avg_Del'];
$rest_avg = $row_prods['Avg_Del'];
echo "
<div id='products_box'>
<div id='products'>
<table>
<tr class='float'>
<td ><h3>$rest_name </h3> </td>
<td><p> Price</p></td>
<td><p>Avg Delivery</p></td>
<td><p>Cost</p></td>
<td></td>
<td><a href='product_page.php'><button id='feed'>Feed Me!</button></a> </td>
</tr>
</table>
</div>
</div>
";
}
any suggestions would be very helpful. newbie trying to learn.
Aucun commentaire:
Enregistrer un commentaire