Jump to content

Pointers


menios

Recommended Posts

I ve been developing a website for fun my index page is in html and i got a db that contains around 1000 different items.I ve managed to retrieve the data from the db and arrange then with pagination

but it s all my items.What i want to do now is connect my category buttons with the specific items from my db.Can anyone advice me on how to do this?

Link to comment
Share on other sites

try

<?php
if (isset($_GET['cat']))
{
    $cat = $_GET['cat'];      //  for simplicity only. 
                              //  Don't trust user input - you should pass GET,POST,COOKIE data through a cleanup function
    $sql = "SELECT * FROM mytable WHERE cat_name = '$cat'";
    echo $sql;
}
?>
<form>
<input type="submit" name="cat" value="Widgets">
<input type="submit" name="cat" value="Gizmos"> 
<input type="submit" name="cat" value="Wotsits"> 
</form>

Link to comment
Share on other sites

Sorry my explanation wasn't detailed. My idea was to create one html file with an iframe in the middle as a display area left side some nav. buttons (nested lists), right side some search engine and a login.

I wanted to keep my pages as few as possible so i ve been trying to use the lists to connect to different parts of the database and display them in the iframe.So just the content of the iframe would change instead of  the page.

My tables are tbl_product and tbl_category. So when i click Category 1 want the iframe to display all the items that belong to category 1.

after naming index.html to index.php what should be my next steps?

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.