Page 1 of 1

Hyperlinking in Tekstboxes

Posted: Sat Mar 20, 2010 12:24 pm
by AFCA
Dear fellow members,

I'm currently working on a website for school and I'm having some problems with it. The project my group got assigned to is to make a website where one could order wine. Since we work in a group, we decided to split tasks up and I got the page where you can view the products. One of the requirements was that the site used a database. I've got that up and running now. Our page lay-out is basically 3 columns. I got the database to return the wine-names into one of the columns, and I've made hyperlinks of them. Now I want the following to happen, but I can't get it fixed: If you click the wine-name, the information on the wine opens up in the most right column.

Code:

Code: Select all

<html>
 <head>
  <meta http-equiv="Generator" content="TigerII MiniPad (C)2001">
   <title>Producten</title>
 <style type="text/css">
 Body {
      background-image: url("achtergrond.jpg");
      background-repeat: no repeat;
      background-attachment: fixed;
 }
 
 .navbar {
      padding-left: 1;
 }
 </style>
 <?php
 $server = "localhost" ;
 $user = "root" ;
 $wachtwoord = "" ;
 $database = "rossano";
 $resultaat = "";
 
 if (!$db = mysql_connect($server, $user, $wachtwoord)){
 
 
      $boodschap = "<h2>Verbinding met de databaseserver is mislukt!</h2>";  
 }; 
if (!mysql_select_db($database)) {
           $boodschap .="de database \"$database\" kon niet gevonden worden!";    
 };  
if (!isset($_GET["id"])){
      $query = "SELECT naam , producent , prijs, jaar, soort, commentaar FROM wijn";
 }
      else{
           $query = "SELECT * FROM wijn";
 }
      $resultaat= mysql_query($query, $db) or die ( "er is een probleem met query");
?>
 
 </head>
  <body>
   <table border="3">
    <tr>
     <td COLSPAN="4"><a><img src="banner.jpg"></a></td>
    </tr>
 
    <tr>
     <td><div class="navbar">
          <a href="Homepage.htm"><img src="home.png" alt="Ga naar de homepagina" width="120" height="24" align="bottom" STYLE="border: solid 1px black;"></a><br>
          <a href="BBBB.htm"><img src="contact.png" alt="Neem contact met ons op" width="120" height="24" align="bottom" STYLE="border: solid 1px black;"></a><br>
          <a href="Producten.php"><img src="producten.png" alt="Bekijk onze producten" width="120" height="24" align="bottom" STYLE="border: solid 1px black;"></a><br>
          <a href="DDDD.htm"><img src="bestellen.png" alt="Rond uw bestelling af" width="120" height="24" align="bottom" STYLE="border: solid 1px black;"></a>
     </div></td>
     
     <td>     <?php 
     
      if (!isset ($GET["naam"])) {
           echo "";
           while(list($naam ,$soort ,$producent ,$prijs ,$jaar ,$commentaar ) = mysql_fetch_row($resultaat)){
                echo "<li><a href=\"" . $_SERVER["PHP_SELF"] . "?naam=$naam\">".  $naam . "</a>\n";
           }
         echo "</ol>";
      }
         else{
               while(list($naam , $soort, $producent, $prijs, $jaar, $commentaar) = 
               mysql_fetch_row($resultaat)){ 
               echo "<h2>Detail-gegevens voor:
                    naam: $naam </h2> 
                    soort: <b>$soort </b><br>
                    producent: <b>$producent </b><br>
                    prijs: <b>$prijs </b><br>
                    jaar: <b>$jaar </b><br>
                    commentaar: <b> $commentaar </b><br>
                    <hr>
                    <a href=\"" . $_SERVER["PHP_SELF"] . "\">
                    Terug naar het overzicht</a>";
         };
         
       Mysql_error();
     };
      mysql_close($db);
      ?>
      </td><td>/Results here/</td>
     <?php echo $boodschap; ?>
    </tr>
   </table>
  </body>
</html>
 
My variables are in Dutch because Im from the Netherlands. If it makes the story unclear, please post so and I'll translate them.

I have included a picture Image for when the story is too vague.


I would really appreciate it if someone could help me solve this problem.

Re: Hyperlinking in Tekstboxes

Posted: Sat Mar 20, 2010 9:48 pm
by ell0bo
I'm not entirely sure what you're asking. Do you want to load the data in there via ajax, or do you just want the info to display the info for just that wine type. You appear to be dumping out all the contents of the database on the click on a link, and then no longer showing the different wine types.

A little more info on how you want this to function would be useful, so I know where to guide you.

Re: Hyperlinking in Tekstboxes

Posted: Sun Mar 21, 2010 6:11 am
by AFCA
"I'm not entirely sure what you're asking. Do you want to load the data in there via ajax, or do you just want the info to display the info for just that wine type. You appear to be dumping out all the contents of the database on the click on a link, and then no longer showing the different wine types.

A little more info on how you want this to function would be useful, so I know where to guide you."


I'm not really familiar with Ajax, so I wouldn't know how to use that function. Seeing we didn't get that much explanation about PhP in school, I doubt we have to make it any harder than we could handle. Therefor I think just simply making the database return all the variables ($producent, $prijs, $soort etc.) for the one wine I click in the right column, whilst the list of clickable wine-names stays where it is.

It's like it has been done on this site:
http://www.rossano.nl/index.php?page=3
If you click on "Uit Piemonte" the wines from Piemonte get shown, if you click on "Uit Veneto" the wines from Veneto get shown. I want the same kind of system on my site, but instead of all the wines from a region being shown, I want the information on the clicked wine to get shown.

I hope this helps you understand my problem.