variable link help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
toplet159
Forum Newbie
Posts: 10
Joined: Sun Jul 11, 2004 1:20 pm

variable link help

Post by toplet159 »

I want to be able to use my current table photogallery with 4 columns $pic1, $pic2, $pic3, $pic4 so when i click on a thumbnail on the previous page it would select the row details and pic out the column pic number
and display that picture on the new page
but for this i would need to do link?details=1&pic=1
but i am not sure how i would write that into this code
help much appreciated thanks

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<?php
include "config.php"; ?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<center>
<body>
<table cellpadding="7" cellspacing="0" class="outsidetable">
<tr>
<td><?php echo" $contentsa"; ?>
  
  <table cellpadding="0" cellspacing="0" class="main">
    <tr>
      <td class="mainpage"><?php if (!$id && !$details) {
  echo"<table width="798" height="30" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td valign="top"><table border="0" cellpadding="0" cellspacing="0" class="pageheaders">
              <tr>
                <td>Events List </td>
              </tr>
          </table></td>
        </tr>
      </table>
	
	 
        <table width="798" height="30" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td valign="top"><table border="0" cellpadding="0" cellspacing="0" class="eventstable">
                <tr>
                  <td class="eventnameheader">Event Name </td>
                  <td class="eventdescriptionheader">Description</td>
                  <td class="eventdateheader">Date</td>
                </tr>
            </table></td>
          </tr>
        </table>      "; }?>
<?php 

echo "<table width="798" height="70" border="0" cellpadding="0" cellspacing="0">"; 
$id = (!empty($_GET['id']) ? $_GET['id'] : false); 
$details = (!empty($_GET['details']) ? $_GET['details'] : false); 
$pica = (!empty($_GET['pica']) ? $_GET['pica'] : false); 
   if (!$id && !$details){   $result = mysql_query("SELECT * FROM eventslist") or die(mysql_error()); 
$num_rows = mysql_num_rows($result); 
while ($u = mysql_fetch_array($result)) { 
extract($u); 
//$f_price = number_format($price,2); 
echo"  
          <tr> 
            <td valign="top" height="30" class="eventshightlighttable" onmousedown="LmDown(this, 'menuentry_hovere')" onmouseup="LmUp('{$_SERVER['SCRIPT_NAME']}?id=$id')" onmouseover="LmOver(this, 'menuentry_hovere')" onmouseout="LmOut(this, 'menuentrye')">   
         <table border="0" cellpadding="0" cellspacing="0" class="eventstable"> 
              <tr> 
                <td width="200" class="eventname">$eventname</td> 
                <td width="498" class="eventdescription">$description</td> 
                <td width="100" class="eventdate">$date</td> 
              </tr>
			  
            </table></td> 
          </tr> 
                               "; 
  } 
} 
elseif ($id && !$details) { $result = mysql_query("SELECT * FROM photogallery WHERE details='$id'") or die(mysql_error()); 
         $num_rows = mysql_num_rows($result); 
         while ($u = mysql_fetch_array($result)) { 
            extract($u); 
            //$f_price = number_format($price,2); 
            echo" <table width="794" height="110" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="110" valign="top" class="eventshightlighttable" onmousedown="LmDown(this, 'menuentry_hovere')" onmouseup="LmUp('{$_SERVER['SCRIPT_NAME']}?details=$id')" onmouseover="LmOver(this, 'menuentry_hovere')" onmouseout="LmOut(this, 'menuentrye')"><table width="794" height="100" border="0" cellpadding="0" cellspacing="0" class="picturetable"><tr>
        <td width="100"><table width="10" height="100" border="0" cellpadding="10" cellspacing="0">
            <tr>
              <td align="center" valign="middle"><table cellpadding="0" cellspacing="0" class="picture">
                                    <tr>
                                      <td><img src="$pic" width="80" height="80"></td>
                                    </tr>
                                </table></td>
            </tr>
        </table></td>
        <td><table width="694" height="82" border="0" cellpadding="0" cellspacing="0" class="picdescription">
            <tr>
              <td>$description</td>
            </tr>
          </table>
            <table width="694" height="20" border="0" cellpadding="0" cellspacing="0" class="picenlarge">
              <tr>
                <td >Click To Enlarge picture</td>
              </tr>
          </table></td>
      </tr>
    </table></td>
  </tr>
                   "; 
  } 
} 

elseif (!$id && $details) { 
   $result = mysql_query("SELECT * FROM photogallery WHERE details='$details'") or die(mysql_error()); 
   $num_rows = mysql_num_rows($result); 
   while ($u = mysql_fetch_array($result)) { 
      extract($u); 
      //$f_price = number_format($price,2); 
      echo"<table width="798" height="400" border="0" cellpadding="0" cellspacing="0"> 
  <tr> 
    <td height="300"><img src="$pic"></td> 
  </tr> 
  <tr> 
    <td height="100">$description</td> 
  </tr>"; 
                  
  } 
} 
echo "</table>\n"; 
?> 
    </td>
      </tr>
  </table>  
  <?php echo" $contentsc"; ?> </td>
</tr>
</table>
</body>
</html>
Post Reply