Location: PHPKode > projects > A2z - Web-based address book > a2z-1.0.2/programs/display.php
<?
include ('dbkey.inc.php');
include ('master.functions.inc.php');
include ('html_head.inc.php');

# HTML TABLE 1 of x #####################################################

print "<TABLE WIDTH = \"100%\" BORDER=\"0\"
	      CELLSPACING = \"2\" CELLPADDING = \"2\">
	<TR><TD ROWSPAN = \"3\" ALIGN = \"LEFT\">";
		

# LIST CONTACT #########################################################

$link_list = mysql_connect($dbhost, $dbuser, $dbpass)
	or die("Could not connect to the Database");
 mysql_select_db($dbname, $link_list)
	or die("Could nor select the databse");
$result_list = mysql_query($select_contact);

while ( $a_row = mysql_fetch_array( $result_list ))
	{
	 # print var_dump($a_row);
	 print "<h2>
		$a_row[FirstName] $a_row[LastName]
		</h2>\n";
	}

# LIST EMAIL ###########################################################

$link_email = mysql_connect($dbhost, $dbuser, $dbpass)
	or die("Could not connect to the Database");
 mysql_select_db($dbname, $link_email)
	or die("Could nor select the databse");
$result_email = mysql_query($select_email);

 print "<TABLE BORDER = \"0\">";
 $nu = 1;
while ( $a_row = mysql_fetch_array( $result_email ))
	{
	 # print var_dump($a_row);
	 print "<TR><TD>
			<FONT CLASS = \"LightGray\">$nu.</FONT>
			<FONT CLASS = \"Gray\">$a_row[Location]</FONT></TD><TD>
		<A HREF=\"mailto:$a_row[Address]\">
			$a_row[Address]
		</A></TD><TD>
		<a href=\"edit.php?edit=Email&eef_action=edit&Serial=$a_row[Serial]\"
		   target = \"main_frame\">
			<IMG SRC = \"../images/button_edit.gif\"
			     ALT = \"Edit this entry\"
			     BORDER = \"0\"></a>
		</TD></TR>\n";
	$nu++;
	}
 print "</TABLE>";
print "<BR><HR ALIGN=\"LEFT\"
	       WIDTH=\"300\" SIZE=\"2\"
	       COLOR=\"Silver\" NOSHADE>
       <BR>";

# LIST PHONE NUMBERS ###################################################

$link_phone = mysql_connect($dbhost, $dbuser, $dbpass)
	or die("Could not connect to the Database");
 mysql_select_db($dbname, $link_phone)
	or die("Could nor select the databse");
$result_phone = mysql_query($select_phonenumber);

 print "<table>";
while ( $a_row = mysql_fetch_array( $result_phone ))
	{
	 print "<TR><TD><FONT CLASS=\"Gray\">$a_row[Location]:</FONT></TD>
		    <TD><FONT CLASS=\"LightGray\">$a_row[intlPrefix]
			$a_row[RegionalCode]</FONT>
			$a_row[PartOne]
			$a_row[PartTwo] ";
			if ( $a_row[Ext] != "" ) {
			     print "ext: $a_row[Ext] "; }
	 print "<a href=\"edit.php?edit=PhoneNumber&epf_action=edit&Serial=$a_row[Serial]\" target = \"main_frame\">
			<IMG SRC = \"../images/button_edit.gif\"
			     ALT = \"Edit this entry\"
			     BORDER = \"0\"></a>
		    </TD>
		</TR>\n";
	}
 print "</table>";
print "<BR><HR ALIGN=\"LEFT\"
	       WIDTH=\"300\" SIZE=\"2\"
	       COLOR=\"Silver\" NOSHADE>
       <BR>";

# LIST STREET ADDRESS ##################################################

$link_address = mysql_connect($dbhost, $dbuser, $dbpass)
	or die("Could not connect to the Database");
 mysql_select_db($dbname, $link_address)
	or die("Could nor select the databse");
$result_address = mysql_query($select_address);

 print "<table>";
while ( $a_row = mysql_fetch_array( $result_address ))
	{
	 print "<TR><TD VALIGN=\"TOP\"><FONT CLASS=\"Gray\">$a_row[Location]:</FONT></TD>
		    <TD>$a_row[Street]<BR>
			$a_row[City], $a_row[State]<BR>
			$a_row[PostalCode]<BR>
			$a_row[Country]
			<BR><BR>
		    </TD>
		    <TD VALIGN=\"TOP\">
			<a href=\"edit.php?edit=Address&eaf_action=edit&Serial=$a_row[Serial]\" target = \"main_frame\">
			<IMG SRC = \"../images/button_edit.gif\"
			     ALT = \"Edit this entry\"
			     BORDER = \"0\"></a>
		    </TD>
		</TR>\n";
	}
 print "</table>";

# HTML TABLE 2 of x #####################################################

print "</TD>
	    <TD HEIGHT = \"20\"></td></TR>
	<TR><TD HEIGHT = \"10\" ALIGN = \"RIGHT\" VALIGN = \"TOP\">";

########################################################################
# EDIT BUTTONS #########################################################

print "<FORM ACTION = \"edit.php\" METHOD = \"POST\">
       <input type = \"hidden\"
	      name = \"ContactID\"
	      value = \"$ContactID\">
       <input type = \"hidden\"
	      name = \"ecf_action\"
	      value = \"edit\">
       <input type = \"image\"
	      src = \"../images/button_modifycontact.gif\"
	      border = \"0\"
	      value = \"submit\">
       </FORM>\n\n";

# print "</TD></TR><TR><TD HEIGHT = \"10\" ALIGN=\"RIGHT\" VALIGN=\"TOP\">";

print "<FORM ACTION = \"edit.php\" METHOD = \"POST\">
       <input type = \"hidden\"
	      name = \"ContactID\"
	      value = \"$ContactID\">
       <input type = \"hidden\"
	      name = \"eef_action\"
	      value = \"add\">
       <input type = \"hidden\"
	      name = \"edit\"
	      value = \"Email\">
       <input type = \"image\"
	      src = \"../images/button_addemail.gif\"
	      border = \"0\"
	      value = \"submit\">
       </FORM>\n\n";

# print "</TD></TR><TR><TD HEIGHT = \"10\">";

print "<FORM ACTION = \"edit.php\" METHOD = \"POST\">
       <input type = \"hidden\"
	      name = \"ContactID\"
	      value = \"$ContactID\">
       <input type = \"hidden\"
	      name = \"epf_action\"
	      value = \"add\">
       <input type = \"hidden\"
	      name = \"edit\"
	      value = \"PhoneNumber\">
       <input type = \"image\"
	      src = \"../images/button_addphonenumber.gif\"
	      border = \"0\"
	      value = \"submit\">
       </FORM>\n\n";

# print "</TD></TR><TR><TD HEIGHT = \"10\">";

print "<FORM ACTION = \"edit.php\" METHOD = \"POST\">
       <input type = \"hidden\"
	      name = \"ContactID\"
	      value = \"$ContactID\">
       <input type = \"hidden\"
	      name = \"eaf_action\"
	      value = \"add\">
       <input type = \"hidden\"
	      name = \"edit\"
	      value = \"Address\">
       <input type = \"image\"
	      src = \"../images/button_addaddress.gif\"
	      border = \"0\"
	      value = \"submit\">
       </FORM>\n\n";

print "</TD></TR><TR><TD HEIGHT=\"90%\"></TR></TABLE>";

include ('html_footer.inc.php');
?>
Return current item: A2z - Web-based address book