...

View Full Version : PHP Output not displaying correctly



scottyrob
02-13-2006, 10:17 PM
Howdy folks

scott.loddonexplorers.co.uk/contacts.php

Two problems with this. The first is that i cannot see the images that should be two the left of everyones name, i can see it when i click to the left of the persons name though. And secondly, the page displays all the data, i only want it so that when you click to the left of the name it displays all the data. Before clicking the button it should only display Each persons name and email...

Any ideas on how to fix this?

Fet

scottyrob
02-13-2006, 10:18 PM
Code is


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Leaders</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link href="css/phpdisplay.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
function showDetails(memberID,button){
var element = document.getElementById(memberID);
if(element.style.display != 'block'){
element.style.display = 'block';
button.style.backgroundImage = 'url("images/minus.gif")';
}else{
element.style.display = 'none';
button.style.backgroundImage = 'url("images/plus.gif")';
}
}
</script>


</head>
<body>
<?php

$connx = @mysql_connect("xx", "cxx", "xx") or
die("ERROR: Unable to establish database connection");

$dbconnx = @mysql_select_db('xx) or
die("ERROR: Unable to establish database connection");

?>
<p class="title">Leader Team</p>
<blockquote>

<?php

$result = @mysql_query('SELECT * FROM `Contacts` GROUP BY `ID`');


if (!$result) {
exit('<p>Error performing query: ' . mysql_error() . '</p>');
}
$num = mysql_num_rows($result);
echo "<div id=\"alldetails\">";
for ($i=0; $i<$num; $i++)
{
$row = mysql_fetch_row($result);
echo "\n<p><input type=\"image\" class=\"button\" id=\"button$i\" value=\" \" onclick=\"showDetails('person$i',this);return true;\"> $row[2] $row[3] <a href=\"mailto:$row[9]\">$row[9]</a></p>\n";
echo "<p id=\"person$i\" class=\"details\">
Position: $row[1]<br>\n
Name: $row[2] $row[3]<br>\n
Address: $row[4]<br>\n
Town: $row[5]<br>\n
Postcode: $row[6]<br>\n
Home Phone: $row[7]<br>\n
Mobile: $row[8]<br>\n
Email: $row[9]</p>";
}
echo "</div>";
?>
</blockquote>
</div>

</body>
</html>

Darth Oinker
02-13-2006, 10:38 PM
Code is

echo "\n<p><input type=\"image\" class=\"button\" id=\"button$i\" value=\" \" onclick=\"showDetails('person$i',this);return true;\"> $row[2] $row[3] <a href=\"mailto:$row[9]\">$row[9]</a></p>\n";
echo "<p id=\"person$i\" class=\"details\">
Position: $row[1]<br>\n
Name: $row[2] $row[3]<br>\n
Address: $row[4]<br>\n
Town: $row[5]<br>\n
Postcode: $row[6]<br>\n
Home Phone: $row[7]<br>\n
Mobile: $row[8]<br>\n
Email: $row[9]</p>";


i *think* that if you make the images just images that part will be fixed, as for the expanded content you'll have to set the display style to none in the DIVs when making output so that the onclick will expand them...

at least i think, i just used someone elses code when i wanted to do it... :o



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum