...

View Full Version : Style sheet not working on PHP



scottyrob
02-13-2006, 07:52 PM
I have this code hear, and the CSS file path is correct, but it dosent seem to want to display... What can i do?



<!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="HP_Display.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>

<noscript>
<style type="text/css">
.details {
display: block;
}
</style>
</noscript>
</head>
<body>
<div class="body_bold">
<?php

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

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

?>
<p class="red_title">Leader Team</p>
<blockquote>
<?php

// Request the text of all the jokes
$result = @mysql_query('SELECT * FROM `Contacts` GROUP BY `ID`'); /* YOU MAY NEED TO EDIT THIS ID SO THAT
IT IS THE SAME AS THE FIELD NAME
IN YOUR DATABASE */
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>

_Aerospace_Eng_
02-13-2006, 07:55 PM
Do you have a link to the site?

scottyrob
02-13-2006, 07:56 PM
Yup sure... either scott.loddonexplorers.co.uk then click on contacts OR scott.loddonexplorers.co.uk/contacts.php

_Aerospace_Eng_
02-13-2006, 08:06 PM
Hmm perhaps the underscore in the css file name is causing the problem. Try using a hyphen or just one word HPdisplay.css

scottyrob
02-13-2006, 08:09 PM
Made no difference...

_Aerospace_Eng_
02-13-2006, 08:15 PM
Try this for the xhtml

<!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 rel="stylesheet" href="HP_display.css" 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>
<div class="body_bold">
<p class="red_title">Leader Team</p>
<blockquote>

<div id="alldetails">
<p><input type="image" class="button" id="button0" value=" " onclick="showDetails('person0',this);return true;" />
Mark Elliott <a href="mailto:buggymanelliott@aol.com">buggymanelliott@aol.com</a></p>
<p id="person0" class="details">
Position: Commissioner<br />
Name: Mark Elliott<br />
Address: 21 Notton Way<br />
Town: Lower Early, Berkshire<br />

Postcode: RG6 4AJ<br />
Home Phone: 0118 9312340<br />
Mobile: 0776 8634625<br />
Email: buggymanelliott@aol.com</p>
<p><input type="image" class="button" id="button1" value=" " onclick="showDetails('person1',this);return true;" />
Colin Stamp <a href="mailto:colin.stamp@uk.ibm.com">colin.stamp@uk.ibm.com</a></p>
<p id="person1" class="details">

Position: Fundraiser &amp; Web Content<br />
Name: Colin Stamp<br />
Address: 35, Western Avenue<br />
Town: Woodley, Berkshire<br />
Postcode: RG5 3BJ<br />
Home Phone: 01189 696901<br />

Mobile: 07980 445691<br />
Email: colin.stamp@uk.ibm.com</p>
<p><input type="image" class="button" id="button2" value=" " onclick="showDetails('person2',this);return true;" />
Lynda Evans <a href="mailto:lyndaevans@zoom.co.uk">lyndaevans@zoom.co.uk</a></p>
<p id="person2" class="details">
Position: Administrator<br />
Name: Lynda Evans<br />

Address: 20 Southlake Crescent<br />
Town: Woodley, Berkshire<br />
Postcode: RG5 3QW<br />
Home Phone: 0118 9694772<br />
Mobile: 0777 6133513<br />
Email: lyndaevans@zoom.co.uk</p>

<p><input type="image" class="button" id="button3" value=" " onclick="showDetails('person3',this);return true;" />
Clair Turnbull <a href="mailto:clairturnbull@aol.com">clairturnbull@aol.com</a></p>
<p id="person3" class="details">
Position: Young Leader Section<br />
Name: Clair Turnbull<br />
Address: 13 Hearn Road<br />
Town: Woodley, Berkshire<br />

Postcode: RG5 3QG<br />
Home Phone: <br />
Mobile: 07813697681<br />
Email: clairturnbull@aol.com</p>
<p><input type="image" class="button" id="button4" value=" " onclick="showDetails('person4',this);return true;" />
Mark Loring <a href="mailto:mark.loring@virgin.net">mark.loring@virgin.net</a></p>
<p id="person4" class="details">

Position: Leader<br />
Name: Mark Loring<br />
Address: 9 St Michaels Court<br />
Town: Ruscombe, Berkshire<br />
Postcode: RG10 9UF<br />
Home Phone: 0118 9342141<br />

Mobile: 0778 0912643<br />
Email: mark.loring@virgin.net</p>
<p><input type="image" class="button" id="button5" value=" " onclick="showDetails('person5',this);return true;" />
Frazer Murray-Hall <a href="mailto:frazer.murray-hall@ntlworld.com">frazer.murray-hall@ntlworld.com</a></p>
<p id="person5" class="details">
Position: Leader<br />
Name: Frazer Murray-Hall<br />

Address: 7 Marathon Close<br />
Town: Woodley, Berkshire<br />
Postcode: RG5 4UN<br />
Home Phone: 0118 9695442<br />
Mobile: 0773 4336483<br />
Email: frazer.murray-hall@ntlworld.com</p>

<p><input type="image" class="button" id="button6" value=" " onclick="showDetails('person6',this);return true;" />
James Finch <a href="mailto:jamesfinch@netvigator.co.uk">jamesfinch@netvigator.co.uk</a></p>
<p id="person6" class="details">
Position: Leader<br />
Name: James Finch<br />
Address: 1 Avon Place<br />
Town: Reading, Berkshire<br />

Postcode: RG1 3LA<br />
Home Phone: 0118 9351686<br />
Mobile: 0792 9506921<br />
Email: jamesfinch@netvigator.co.uk</p>
<p><input type="image" class="button" id="button7" value=" " onclick="showDetails('person7',this);return true;" />
Rob James <a href="mailto:street@jdmworld.co.uk">street@jdmworld.co.uk</a></p>
<p id="person7" class="details">

Position: Leader<br />
Name: Rob James<br />
Address: 29 Telford Crescent<br />
Town: Woodley, Berkshire<br />
Postcode: RG5 4QT<br />
Home Phone: 0118 9691595<br />

Mobile: 0787 1600084<br />
Email: street@jdmworld.co.uk</p>
<p><input type="image" class="button" id="button8" value=" " onclick="showDetails('person8',this);return true;" />
Hazel Evans <a href="mailto:hg.evans@ntlworld.com">hg.evans@ntlworld.com</a></p>
<p id="person8" class="details">
Position: Leader<br />
Name: Hazel Evans<br />

Address: 49 Hurst Road <br />
Town: Twyford<br />
Postcode: RG10 OAH<br />
Home Phone: 0118 9016647<br />
Mobile: 0771 7792201<br />
Email: hg.evans@ntlworld.com</p>

<p><input type="image" class="button" id="button9" value=" " onclick="showDetails('person9',this);return true;" />
Bill Evans <a href="mailto:w.evans@kingston.ac.uk">w.evans@kingston.ac.uk</a></p>
<p id="person9" class="details">
Position: Leader<br />
Name: Bill Evans<br />
Address: 49 Hurst Road<br />
Town: Twyford, Berkshire<br />

Postcode: RG10 OAH<br />
Home Phone: 0118 9016643<br />
Mobile: 0776 6515718<br />
Email: w.evans@kingston.ac.uk</p>
<p><input type="image" class="button" id="button10" value=" " onclick="showDetails('person10',this);return true;" />
Anne-Marie Elliott <a href="mailto:buggymanelliott@aol.com">buggymanelliott@aol.com</a></p>
<p id="person10" class="details">

Position: Leader<br />
Name: Anne-Marie Elliott<br />
Address: 21 Notton Way<br />
Town: Lower Early, Berkshire<br />
Postcode: RG6 4AJ<br />
Home Phone: 0118 9312340<br />

Mobile: 0785 0796565<br />
Email: buggymanelliott@aol.com</p>
<p><input type="image" class="button" id="button11" value=" " onclick="showDetails('person11',this);return true;" />
Chris Evans <a href="mailto:Christopher.evans2@zoom.co.uk">Christopher.evans2@zoom.co.uk</a></p>
<p id="person11" class="details">
Position: Leader<br />
Name: Chris Evans<br />

Address: 2 Gladbridge Close<br />
Town: Early, Berkshire<br />
Postcode: RG6 7DL<br />
Home Phone: 0118 9661227<br />
Mobile: 0790 0493195<br />
Email: Christopher.evans2@zoom.co.uk</p>

<p><input type="image" class="button" id="button12" value=" " onclick="showDetails('person12',this);return true;" />
Chris Greenfield <a href="mailto:The.chris.greenfield@hushmail.com">The.chris.greenfield@hushmail.com</a></p>
<p id="person12" class="details">
Position: Leader<br />
Name: Chris Greenfield<br />
Address: 51 Meadow Way<br />
Town: Theale, Berkshire<br />

Postcode: RG7 4AU<br />
Home Phone: <br />
Mobile: 0774 7800540<br />
Email: The.chris.greenfield@hushmail.com</p>
<p><input type="image" class="button" id="button13" value=" " onclick="showDetails('person13',this);return true;" />
Scott (aka Fet) <a href="mailto:scott@family-robinson.net">scott@family-robinson.net</a></p>
<p id="person13" class="details">

Position: WebMaster<br />
Name: Scott (aka Fet) <br />
Address: <br />
Town: Charvil<br />
Postcode: <br />
Home Phone: <br />

Mobile: <br />
Email: scott@family-robinson.net</p></div></blockquote>
</div>

</body>
</html>
I changed around the attributes in your <link /> tag.
Try the attached CSS file. It may be the way it was saved not sure.

scottyrob
02-13-2006, 08:20 PM
I cannot use the above XHTML. The people on that list are being called from a database which is editable...

_Aerospace_Eng_
02-13-2006, 10:09 PM
Okay the XHTML isn't really pertinent. Its the stuff in the head section along with the CSS I attached.

scottyrob
02-13-2006, 10:15 PM
Its fixed now.. i hadnt spelt stylesheet correctly lol... for somereason it showed it correectly on here though... thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum