Jump to content


Photo

Style Sheet and PHP


  • Please log in to reply
5 replies to this topic

#1 jwwceo

jwwceo
  • Members
  • PipPipPip
  • Advanced Member
  • 212 posts

Posted 27 August 2006 - 10:34 PM

I have some text at the end of my code that allows the user to know that they have succesfully added or deleted or edited a file in MySQL. They say things like "product added" or "product updated". For some reason this text does not adhere to the style sheets I'm using on all the pages.

Anyone experience this before???

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 27 August 2006 - 10:37 PM

post your code ok.

are you using include"file.css"; or require_once"file.css";
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 jwwceo

jwwceo
  • Members
  • PipPipPip
  • Advanced Member
  • 212 posts

Posted 27 August 2006 - 10:41 PM

<html>
<link href="style.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="ds.css">

<head>
<title>LiquidCotton.com Admin - Edit/Delete Shirt</title>
</head>
<body bgcolor="#FFFFFF">

<?php

include 'library/config.php';
include 'library/opendb.php';
error_reporting(0);


$shirt_id = $_GET['shirt_id'];

if(isset($_POST['delete'])) {

$query = "DELETE from shirts WHERE shirt_id='$shirt_id'";
$result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);

    echo "
<a href='admin.php'><img src='images/logo.gif' border='0'></a><br><br>
    Your shirt has been deleted!";

}



elseif(isset($_POST['submit'])) {

  $name=$_POST['name'];
  $comment=$_POST['comment'];
  $link=$_POST['link'];
  $site=$_POST['site'];
  $image=$_POST['image'];
  $active=$_POST['active'];
  $commission=$_POST['commission'];

  $query="UPDATE shirts SET name='$name', comment='$comment', link='$link', site ='$site',
  image ='$image', active ='$active', commission ='$commission' WHERE shirt_id ='$shirt_id'";

  $result = mysql_query($query) or die("Error: ". mysql_error(). " with query ". $query);
    echo
    "<a href='admin.php'><img src='images/logo.gif' border='0'></a>
    <br><br>Your shirt has been updated!";


} else
{


$data = mysql_query("SELECT * FROM shirts WHERE shirt_id ='$shirt_id'") or die(mysql_error());
$info = mysql_fetch_array( $data );

echo "<a href='admin.php'><img src='images/logo.gif' border='0'></a><br>
<form method='post' action='edit.php?shirt_id=$shirt_id'>
<TABLE>
<TR>
  <TD>Name:</TD>
  <TD><INPUT TYPE='TEXT' NAME='name'  size=50 value='".$info['name']."'></TD>
</TR>
<TR>
  <TD>Comment</TD>
  <TD><textarea rows='5' cols='50' name='comment'>".$info['comment']."</textarea>
</TD>
</TR>
<TR>
  <TD>Link</TD>
  <TD><INPUT TYPE='TEXT' NAME='link'  size=50 value='".$info['link']."'></TD>
</TR>
<TR>
  <TD>Site</TD>
  <TD><INPUT TYPE='TEXT' NAME='site'  size=50 value='".$info['site']."'></TD>
</TR>
<TR>
  <TD>Image</TD>
  <TD><INPUT TYPE='TEXT' NAME='image'  size=50 value='".$info['image']."'></TD>
</TR>
<TR>
  <TD>Active</TD>";

if($info['image'] == 'true') {


echo

  "<TD><input type='radio' name='active' value='true' CHECKED> Active
<br>
<input type='radio' name='active' value='false'> Inactive
  </TD>";

  }


  else {

  echo "<TD><input type='radio' name='active' value='true' > Active
<br>
<input type='radio' name='active' value='false' CHECKED> Inactive
  </TD>";

  }

echo

"</TR>
<TR>
  <TD>Commission</TD>
  <TD><INPUT TYPE='TEXT' NAME='commission' size=50 value='".$info['commission']."'></TD>
</TR>
<TR>
  <TD></TD>

  <TD><INPUT TYPE='submit' name='submit' value='Edit this Tee'>
      <INPUT TYPE='submit' name='delete' value=' Delete this Tee'></TD>
</TR>

</TABLE>
</form>";


}
?>

</body>
</html>



#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 27 August 2006 - 10:45 PM

I dont see anywhere in your html where you specify which css to use.

#5 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 27 August 2006 - 10:50 PM

Assuming both 'style.css' and 'ds.css' exist in the same folder as this file, the text styling of ds.css will overwrite/over-ride the styling in style.css if identical style attributes are included.

Since the text you're concerned about isn't in any container other than the body, you would need to style it thus:

body {
    font-family: arial, helvetica, sans-serif;
    .... etc
}

Does that help?
Legend has it that reading the manual never killed anyone.
My site

#6 jwwceo

jwwceo
  • Members
  • PipPipPip
  • Advanced Member
  • 212 posts

Posted 27 August 2006 - 10:53 PM

Yes. I didn't know that text needed to be in a container to have style sheets apply to it..I threw it in a <p> and it works fine.

Thanks!!!!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users