Jump to content

make link php


wiredphp

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.