Jump to content

Recommended Posts

Hi, I'm doing web page menu that will be stored in mysql database called 'menitest' it has 2 fields, menu id (INT) and item (VARCHAR). For now I made index.php and style.css, menu is ul list, connection to database works, and I'm managed to get everythig works. menu is populated from database, and that is fine, but what I need is help to make menu items to links to another pages. here is the code for now.

index.php

<?php
include('testconnect.php');
//calling menu from database
$query_sql = "SELECT * FROM meni";
$item_query = mysql_query($query_sql) or die(mysql_error());
$rsitem = mysql_fetch_assoc($item_query);
?>
<! DOCTYPE html>
<html>
<head><title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<link rel="stylesheet" href="style2.css" type="text/css" />

</head>
<body>
<nav>
    <ul>
        <?php
        do {
        ?>
        <li><a href="menutest.php?meni_ID=<?php echo $rsitem['meni_ID']; ?>"><?php echo $rsitem['item']; ?></a></li>
        <?php    
        }while ($rsitem = mysql_fetch_assoc($item_query));
        ?>
    </ul>
</nav>
</body>
</html>

menutest.php does not be there, it just page that I use for testig to see if it works...

Link to comment
https://forums.phpfreaks.com/topic/276355-make-link-php/
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.