Help needed with trying to make a detail page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • warezguy05
    New Member
    • Oct 2006
    • 14

    Help needed with trying to make a detail page

    hi

    im pretty new in php (and programming at all), but for a project at school i need to make a festival-site where volunteers can sign up to work at a festival and those people can be 'reserved' by festival-owners to work at their festival.

    okay..registrat ion system is done and its also possible already to show a list of volunteers that have been signed up, but now i'd like to make a page where festival-owners can see some extra details of the volunteers.

    This is the code;

    Code:
    
    $query = "SELECT VRIJWILLIGER_ID, VOORNAAM, ACHTERNAAM, ADRES, POSTCODE, PLAATS, TELNUMMER, BESCHIKBAAR FROM VRIJWILLIGER";
     $result = mysql_query($query)
         or die("Er is een fout opgetreden");
    
    $num=mysql_numrows($result);
    ?>
    
    
    <table border="0" cellspacing="2" cellpadding="2">
    <tr>
    <th><font face="Arial, Helvetica, sans-serif">ID</font></th>
    <th><font face="Arial, Helvetica, sans-serif">Voornaam</font></th>
    <th><font face="Arial, Helvetica, sans-serif">Achternaam</font></th>
    <th><font face="Arial, Helvetica, sans-serif">Adres</font></th>
    <th><font face="Arial, Helvetica, sans-serif">Postcode</font></th>
    <th><font face="Arial, Helvetica, sans-serif">Plaats</font></th>
    <th><font face="Arial, Helvetica, sans-serif">Telefoon</font></th>
    <th><font face="Arial, Helvetica, sans-serif">Beschikbaar</font></th>
    </tr>
    
    <?
    $i=0;
    while ($i < $num) {
    
    $id=mysql_result($result,$i,"VRIJWILLIGER_ID");
    $voornaam=mysql_result($result,$i,"VOORNAAM");
    $achternaam=mysql_result($result,$i,"ACHTERNAAM");
    $adres=mysql_result($result,$i,"ADRES");
    $postcode=mysql_result($result,$i,"POSTCODE");
    $plaats=mysql_result($result,$i,"PLAATS");
    $telefoon=mysql_result($result,$i,"TELNUMMER");
    $beschikbaar=mysql_result($result,$i,"BESCHIKBAAR");
    
    
    
    
    if ($beschikbaar==1)
    { $beschikbaar = "YES, <a href=\"bookvolunteer.php?id=" . $row["id"] . "\">BOOK ME</a>"; 
    
    }
    else
    { $beschikbaar = "NO";
    }
    
    
    
    ?>
    
    
    <tr>
    <td><font face="Arial, Helvetica, sans-serif"><? echo $id; ?></font></td>
    <td><font face="Arial, Helvetica, sans-serif"><? echo $voornaam; ?></font></td>
    <td><font face="Arial, Helvetica, sans-serif"><? echo $achternaam; ?></font></td>
    <td><font face="Arial, Helvetica, sans-serif"><? echo $adres; ?></font></td>
    <td><font face="Arial, Helvetica, sans-serif"><? echo $postcode; ?></font></td>
    <td><font face="Arial, Helvetica, sans-serif"><? echo $plaats; ?></font></td>
    <td><font face="Arial, Helvetica, sans-serif"><? echo $telefoon; ?></font></td>
    <td><font face="Arial, Helvetica, sans-serif"><? echo $beschikbaar; ?></font></td>
    </tr>
    
    <?
    $i++;
    }
    
    
    echo "</table>";
    the variables are dutch so most ppl cant probably read only half of it..but i need to know how to be able to go to a page where i can read contact-details of a volunteer.

    i think i need a code like this:

    Code:
    if ($beschikbaar==1)
    { $beschikbaar = "YES, <a href=\"bookvolunteer.php?id=" . $row["id"] . "\">BOOK ME</a>";
    so when people click on "BOOK ME", they would go to the bookvolunteer.p hp page using the ID of the person where the link was printed next to,,,but that doesnt work. the url stays empty like this "http://www.yourdomain. com/bookvolunteer.p hp?id="

    how can i fix this?
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Why are you re-arranging the $beschikbaar variable from integer to char, as in [php]if ($beschikbaar== 1)
    { $beschikbaar = "YES, <a href=\"bookvolu nteer.php?id=" . $row["id"] . "\">BOOK ME</a>"; [/php]
    You can do it like this (3 methods):[php]
    // if you want the value to be enclosed in quotes and echo it later:
    if ($beschikbaar== 1)
    $KijkLink = "<a href=\"bookvolu nteer.php?id='" . $row["id"] . "'\">BOOK ME</a>";
    echo $KijkLink;
    // if you do not want the value to be enclosed in quotes and echo it later:
    if ($beschikbaar== 1)
    $KijkLink = "<a href=\"bookvolu nteer.php?id=" . $row["id"] . "\">BOOK ME</a>";
    echo $KijkLink;
    // if you want to echo straight away:
    if ($beschikbaar== 1)
    echo "<a href=\"bookvolu nteer.php?id=" . $row["id"] . "\">BOOK ME</a>";
    [/php]
    Btw, Dutch is acceptable to me! Veel plezier met het festival.

    Ronald :cool:

    Comment

    • warezguy05
      New Member
      • Oct 2006
      • 14

      #3
      thanks for your input Ronald. although your suggestions didn't work out properly for me..i had to adjust the code a little bit, and now it works well :)

      i had to put the dollar-sign before 'id' and remove the row-stuff


      Code:
      $KijkLink = "<a href=\"bookvolunteer.php?id=" . $row["id"] . "\">BOOK ME</a>";
      echo $KijkLink;

      has become;

      Code:
      $Kijklink="<a href=\"bookvolunteer.php?id=" . $id . "\">BOOK ME</a>"; 
      echo $Kijklink;
      :)

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        If you place a php variable in a double quoted string, you don't have to use concatenation, so your statement becomes:
        [PHP]$Kijklink="<a href=\"bookvolu nteer.php?id=$i d\">BOOK ME</a>";
        echo $Kijklink;[/PHP]

        Ronald :cool:

        Comment

        Working...