Jump to content

I can't get the css file to load. Help needed.


vet911

Recommended Posts

I'm trying to use a css file to manage the tables listed when the program runs. The listings are fine but the css file doesn't load to correct the look.

Any help would be appreciated.

I showed the css file and the script.

 

<style type="text/css"> 

form.style1 fieldset { 
padding: 1em; 
font:80%/1 sans-serif;
background-color: #f0f0f0;  
} 
form.style1 label { 
float:left; 
width:25%; 
margin-right:0.5em; 
padding-top:0.2em; 
text-align:right; 
font-weight:bold;
} 
  

  
  
body { margin: 2em } 
  
h4 { margin-top:2em } 
  
input { font-size:100%; vertical-align:middle } 
  
  
</style> 

 

<?php

$con = mysql_connect("localhost", "root", "1910") or die ('Error connecting to mysql');
mysql_select_db("cmc_members") or die(mysql_error());


$result = mysql_query("SELECT * FROM members ORDER BY lname") or die(mysql_error());
// store the record of the "members" table into $row
$current = '';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title> </title>
<link rel="stylesheet" type="text/css" href="form.css" />

</head>
<body>


<?php
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
$id = $row['id'];
if (!$current) {
echo "<center><div><table border='0' width='300' cellspacing='1' cellpadding='3' bgcolor='#f0f0f0' >";
$current = $id;
} elseif ($current != $id){
echo "</table></div><br><br><div><table border='0' width='300' cellspacing='1' cellpadding='3' bgcolor='#f0f0f0' >";
$current = $id;
}
?>


<form class="style1">
  <fieldset>
  <legend>Membership Information</legend>
    <label for="fname">First Name:</label>
    <input type="text" name="fname" id="fname" value="<?= $row['fname']; ?>"size="30" />
    <br />
    <label for="mname">Middle Name:</label>
    <input type="text" name="mname" id="mname" value="<?= $row['mname']; ?>"size="30" />
    <br />
  <label for="lname">Last Name:</label>
    <input type="text" name="lname" id="lname" value="<?= $row['lname']; ?>"size="30" />
    <br />
    <label for="address">Address:</label>
    <input type="text" name="address" id="address" value="<?= $row['address']; ?>"size="40" />
    <br />
    <label for="city">City:</label>
    <input type="text" name="city" id="city" value="<?= $row['city']; ?>"size="20"  />
    <br />
    <label for="state">State:</label>
    <input type="text" name="state" id="state" value="<?= $row['state']; ?>"size="2"  />
    <br />
    <label for="zip">Zip Code:</label>
    <input type="text" name="zip" id="zip" value="<?= $row['zip']; ?>"size="4"  />
    <br />
    <label for="country">Country:</label>
    <input type="text" name="country" id="country" value="<?= $row['country']; ?>"size="4"  />
    <br />
    <label for="phone">Phone:</label>
    <input type="text" name="phone" id="phone" value="<?= $row['phone']; ?>"size="30" />
    <br />
    <label for="mobile">Mobile:</label>
    <input type="text" name="mobile" id="mobile" value="<?= $row['mobile']; ?>"size="30" />
    <br />
    <label for="categories">Categories:</label>
    <input type="text" name="categories" id="categories" value="<?= $row['categories']; ?>"size="120" />
    <br />
    <label for="email">Email:</label>
    <input type="text" name="email" id="email" value="<?= $row['email']; ?>"size="30" />
    <br />
    <label for="email2">Email2:</label>
    <input type="text" name="email2" id="email2" value="<?= $row['email2']; ?>"size="30" />
    <br />
    <label for="notes">Notes:</label>
    <input type="text" name="notes" id="notes" value="<?= $row['notes']; ?>"size="120" />
    <br />
    <label for="webpage">Webpage:</label>
    <input type="text" name="webpage" id="webpage" value="<?= $row['webpage']; ?>"size="120" />
    <br />
    <label for="member">Member:</label>
    <input type="text" name="member" id="member" value="<?= $row['member']; ?>"size="3" />
    <br />
    <input class="submit" type="submit" value="Submit" />
    <br />
    
  </fieldset>
</form>
<?php
}
echo "</table></div></center>";
?>
<?php
mysql_close();
?>
<br></div>
<?php include('footer.php');?>

Link to comment
Share on other sites

Did I post in the wrong forum?

Okay, so the form and the css work fine before the php was added, could this possiblybe the problem? The php worked before the css was added to the form. I guessing one is the problem but can't find out which one.

Any help or comments would be a ppreciated. Thanks

Link to comment
Share on other sites

The name of your table class is .style1, I'd write it like this

 

<style type="text/css">

.style1 { /* this style is for the whole table */

padding: 1em;

font:80%/1 sans-serif;

background-color: #f0f0f0;

}

 

/* this needs  a different name but it's the same name, if it's for a lable I'd write <label for="mname" class="label-style" >Middle Name:</label> */

.label-style {

float:left;

width:25%;

margin-right:0.5em;

padding-top:0.2em;

text-align:right;

font-weight:bold;

}

 

/* you didn't have semicolons after the styles */

body { margin: 2em };

h4 { margin-top:2em };

input { font-size:100%; vertical-align:middle } ;

<style>

Link to comment
Share on other sites

Thanks for the help, I tried what you suggested, the code is below. The picture shows (see attachment) what has happened to the form. Not quite what I expected.

 

pic1.png is what the change made, pic2.png is what I'm looking for.

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>Capital Mineral Club.org </title>
  <style type="text/css">
.style1 { /* this style is for the whole table */
padding: 1em;
font:80%/1 sans-serif;
background-color: #f0f0f0;
}

/* this needs  a different name but it's the same name, if it's for a lable I'd write <label for="mname" class="label-style" >Middle Name:</label> */
.label-style {
float:left;
width:25%;
margin-right:0.5em;
padding-top:0.2em;
text-align:right;
font-weight:bold;
}

/* you didn't have semicolons after the styles */
body { margin: 2em };
h4 { margin-top:2em };
input { font-size:100%; vertical-align:middle } ;
</style>

</head>
<body>
<?php

$con = mysql_connect("localhost", "root", "1910") or die ('Error connecting to mysql');
mysql_select_db("cmc_members") or die(mysql_error());


$result = mysql_query("SELECT * FROM members ORDER BY lname") or die(mysql_error());
// store the record of the "members" table into $row
$current = '';

// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
$id = $row['id'];
if (!$current) {
echo "<div><table border='0' width='600' cellspacing='1' cellpadding='3' bgcolor='#f0f0f0' >";
$current = $id;
} elseif ($current != $id){
echo "</table></div><br><br><div><table border='0' width='600' cellspacing='1' cellpadding='3' bgcolor='#f0f0f0' >";
$current = $id;
}
?>


<form class="style1">
  <fieldset>
  <legend>Membership Information</legend>
    <label for="fname" class="label-style">First Name:</label>
    <input type="text" name="fname" id="fname" value="<?= $row['fname']; ?>"size="20" />
    <br />
    <label for="mname" class="label-style">Middle Name:</label>
    <input type="text" name="mname" id="mname" value="<?= $row['mname']; ?>"size="20" />
    <br />
  <label for="lname" class="label-style">Last Name:</label>
    <input type="text" name="lname" id="lname" value="<?= $row['lname']; ?>"size="20" />
    <br />
    <label for="address" class="label-style">Address:</label>
    <input type="text" name="address" id="address" value="<?= $row['address']; ?>"size="40" />
    <br />
    <label for="city" class="label-style">City:</label>
    <input type="text" name="city" id="city" value="<?= $row['city']; ?>"size="20"  />
    <br />
    <label for="state" class="label-style">State:</label>
    <input type="text" name="state" id="state" value="<?= $row['state']; ?>"size="2"  />
    <br />
    <label for="zip" class="label-style">Zip Code:</label>
    <input type="text" name="zip" id="zip" value="<?= $row['zip']; ?>"size="4"  />
    <br />
    <label for="country">Country:</label>
    <input type="text" name="country" id="country" value="<?= $row['country']; ?>"size="4"  />
    <br />
    <label for="phone">Phone:</label>
    <input type="text" name="phone" id="phone" value="<?= $row['phone']; ?>"size="30" />
    
    <label for="mobile">Mobile:</label>
    <input type="text" name="mobile" id="mobile" value="<?= $row['mobile']; ?>"size="30" />
    <br />
    <label for="categories">Categories:</label>
    <input type="text" name="categories" id="categories" value="<?= $row['categories']; ?>"size="120" />
    <br />
    <label for="email">Email:</label>
    <input type="text" name="email" id="email" value="<?= $row['email']; ?>"size="30" />
    
    <label for="email2">Email2:</label>
    <input type="text" name="email2" id="email2" value="<?= $row['email2']; ?>"size="30" />
    <br />
    <label for="notes">Notes:</label>
    <input type="text" name="notes" id="notes" value="<?= $row['notes']; ?>"size="120" />
    <br />
    <label for="webpage">Webpage:</label>
    <input type="text" name="webpage" id="webpage" value="<?= $row['webpage']; ?>"size="120" />
    <br />
    <label for="member">Member:</label>
    <input type="text" name="member" id="member" value="<?= $row['member']; ?>"size="3" />
    <br />
    <label for="update">Update:</label><a href="update_member.php?id=<? echo $row['id'];?>">Update</a>
    
  </fieldset>
</form>
<?php
}
echo "</table></div></center>";
?>
<?php
mysql_close();
?>
<br></div>
<?php include('footer.php');?>

 

[attachment deleted by admin]

Link to comment
Share on other sites

I don't see anything containing your input tags or any row tags. Maybe someone in the know will show up and give you better advice.

 

Do you have a tag(s) missing? Also Run your html code through http://validator.w3.org/ and it may tell you.

 

I'm not that familiar with lables and such, I just use the standard tr th and td tags

Link to comment
Share on other sites

In your external stylesheet remove the open and style tag: <style type="text/css">  ......................  </style>

 

your external stylesheet should looks like this:

form.style1 fieldset { 
padding: 1em; 
font:80%/1 sans-serif;
background-color: #f0f0f0;  
} 
form.style1 label { 
float:left; 
width:25%; 
margin-right:0.5em; 
padding-top:0.2em; 
text-align:right; 
font-weight:bold;
} 
  

  
  
body { margin: 2em } 
  
h4 { margin-top:2em } 
  
input { font-size:100%; vertical-align:middle } 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.