Page 1 of 1

link to another page

Posted: Mon Nov 13, 2006 2:10 pm
by franknu
ok, I am confuse on this one, i was just wondering if there is any function that if the user click on a link , it will them to another page where there is more info

this a the link where the user will click if he/she wants to know more about that particular subject or item

Code: Select all

echo '<a href="includefiles/bizwebpage2.php">' . $row['BusinessName'] . '</a>';
now this the code for page bizwebpage2

Code: Select all

<?php

$host = "localhost";
$username = "localhost";
$password = "abc123";
$database = "contacts";




$db = mysql_connect($host, $username, $password) or die(mysql_error()); 
mysql_select_db($database) or die(mysql_error()); 


 $Keyword = addslashes ($_POST['Keyword']);
 $Picture1 = addslashes (isset ($_POST['Picture1']));
 $Headline = addslashes ($_POST['Headline']);
 $Slogan2 = addslashes ($_POST['Slogan2']);
 $Description1 = addslashes ($_POST['Description1']);
 $Description2 = addslashes ($_POST['Description2']);
 $Description3= addslashes ($_POST['Description3']);
 $Contact2 = addslashes ($_POST['Contact2']);
 $Picture2 = addslashes (isset($_POST['Picture2']));
 $Picture3 = addslashes (isset($_POST['Picture3']));



if($BusinessName==$BusinessName)

{
 $query = "SELECT * FROM `business_info` WHERE `BusinessName`='BusinessName'";
 $result = mysql_query($query) or die (mysql_error());
 $num_result = mysql_num_rows($result);

echo "<table>";
  echo "<tr>";
    echo "<td>"; 
	
	echo "<table>";
	
        echo"<tr>";
          echo"<td  valign='top'>";
		  
		 echo" <table>";
             echo " <tr>";
                echo "<td valign='top'>";
				echo "<table>";
                    echo "<tr> ";
                      echo "<td>";
					  echo "$Logo";
					 echo" </td>";
                    echo "</tr>";
                    echo"<tr>"; 
                      echo "<td  valign='top'><h2>$BusinessName</h2>";
                       echo " <p>&nbsp;</p></td>";
                    echo "</tr>";
                    echo "<tr> ";
                    echo "<td valign='top'>$Description2</td>";
					
                    echo "</tr>";
                    echo "<tr> ";
                      echo "<td  valign='top'>$Description3</td>";
                    echo "</tr>";
                    echo "<tr>";
                      echo "<td valign='top'>$Contacts</td>";
                    echo "</tr>";
                  echo "</table>";
				  echo "</td>";
              echo "</tr>";
            echo "</table>";
			
			 echo "</td>";
         echo" <td valign='top'>";
		 echo" <table>";
         echo "<tr>";
                echo "<td>&nbsp;</td>";
              echo "</tr>";
              echo "<tr>";
                echo "<td valign='top'>$picture2</td>";
              echo "</tr>";
              echo "<tr>";
                echo "<td valign='top'>$Picture3</td>";
              echo "</tr>";
            echo "</table>";
			
			echo "</td>";
        echo "</tr>";
      echo"</table>";
      echo"<table border='1'>";
        echo"<tr>";
          echo"<td>include something </td>";
        echo "</tr>";
      echo "</table>";
	  echo " </td>";
  echo "</tr>";
echo "</table>";
?>

Posted: Mon Nov 13, 2006 4:22 pm
by feyd
Find out more information about the text they clicked when the link itself isn't specific on what they clicked? No, not really.

Code: Select all

if($BusinessName==$BusinessName)
Last I checked, that would always be true.

Posted: Mon Nov 13, 2006 5:17 pm
by RobertGonzalez
In your code, you can link to the page that is displaying the list and make a link to the same page with a query string value added to identify the record you want to look more closely at.

Code: Select all

<?php
$sql = 'SELECT * FROM people';
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_array($result))
{
    echo '<a href="' . basename($_SERVER['SCRIPT_FILENAME']) . '?id=' . $row['people_id'] . '">' . $row['people_name'] . '</a>';
}
?>
Then, in the same page, check to see if that variable is being looked for...

Code: Select all

<?php
if (isset($_GET['id']))
{
    $id = $_GET['id'];

    $sql = 'SELECT * FROM people WHERE people_id = ' . $id;
    // yadda yadda, process the rest and show what you want
}
?>
Basically you are looking at creating a list/detail report.