[solved] stupid css and php question
Moderator: General Moderators
[solved] stupid css and php question
hey - very new to this all, am slowly getting my head around it all!
one quick question - hopefulyl you can point me in the right direction.
I use an external css to format all the text on my site however it does not format text from a php echo - is there something extra i need to do?
thanks
one quick question - hopefulyl you can point me in the right direction.
I use an external css to format all the text on my site however it does not format text from a php echo - is there something extra i need to do?
thanks
Last edited by tom.cull on Fri Sep 16, 2005 5:51 am, edited 1 time in total.
- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
Code: Select all
<style>
.bold{
font-weight:bolder;
}
</style>
<span class = 'bold'>I should be bold</span>Code: Select all
<?php
echo "<span class = 'bold'>I should be bold as well</span>";
?>The browser sees the HTML and CSS coming from the server. It has no idea if the code was straight HTML or created by PHP.
In other words, it doesn't matter whether you've echoed the code from php or not.
Use your web browser to view the resultant HTML code and see if you can tell why it is ignoring the css style.
Failing that, post your PHP here.
In other words, it doesn't matter whether you've echoed the code from php or not.
Use your web browser to view the resultant HTML code and see if you can tell why it is ignoring the css style.
Failing that, post your PHP here.
hmm - ok here is the code.
When looking at the results the page is formatted OK APART from everything outputting from an echo:
The html that is out put is :
ideas? thanks
When looking at the results the page is formatted OK APART from everything outputting from an echo:
Code: Select all
<?php
if ($submit) {
$username="xxxx";
$password="xxxx";
$database="xxxx_xxxx";
$location_area=$_POST['location_area'];
$car_pbracket=$_POST['car_pbracket'];
mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
if ($location_area == '*') $location_area = "location_area";
else $location_area = "'$location_area'"; // notice the single quotes inside the double quotes
if ($car_pbracket == '*') $car_pbracket = "car_pbracket";
else $car_pbracket = "'$car_pbracket'"; // notice the single quotes inside the double quotes
// retrieve all the rows from the database
$query = "SELECT * FROM xxx_xxxWHERE (location_area LIKE $location_area) AND (car_pbracket LIKE $car_pbracket) AND (list_status='active')";
$results = mysql_query( $query );
// print out the results
if( $results )
{
while( $contact = mysql_fetch_object( $results ) )
{
// print out the info
$id = $contact -> id;
$contact_nlast = $contact -> contact_nlast;
$contact_nfirst = $contact -> contact_nfirst;
$car_make = $contact -> car_make;
$car_model = $contact -> car_model;
echo( "<a href=\"showdetails.php?id={$id}\">{$id} . {$contact_nfirst}, {$contact_nlast} - {$car_make}, {$car_model}</a><br />" );
}
}
else
{
die( "Trouble getting contacts from database: " . mysql_error() );
}
}
?>
</body>
</html>Code: Select all
....
<p> </p>
<a href="showdetails.php?id=1">1 . Tom, Cull - Fiat, Punto</a><br /><a href="showdetails.php?id=8">8 . Steve, Wood - , </a><br /><a href="showdetails.php?id=3">3 . Curt, ockleford - Renault, Clio</a><br /><a href="showdetails.php?id=6">6 . Test234, Tets234 - , </a><br /><a href="showdetails.php?id=7">7 . Richard, Bevan - ford, mondeo</a><br /><a href="showdetails.php?id=9">9 . Steve, Wood - Rover, 18</a><br /><a href="showdetails.php?id=10">10 . Emily, Cull - Rover, </a><br />
</body>
</html>- raghavan20
- DevNet Resident
- Posts: 1451
- Joined: Sat Jun 11, 2005 6:57 am
- Location: London, UK
- Contact:
Code: Select all
echo( "<a href=\"showdetails.php?id={$id}\">{$id} . {$contact_nfirst}, {$contact_nlast} - {$car_make}, {$car_model}</a><br />" );else try like
Code: Select all
<a href="showdetails.php?id=<?php echo $id; ?>"><?php echo $contact_nfirst.",".$contact_nlast."-".$car_make.",".$car_model?></a><br />strange. I removed the curly brakets - not chahnge.
i did notice however that some of the css is working ie when I roll over the link it is displaying as specified - its just the type face that is not correct!
html is out put as :
i did notice however that some of the css is working ie when I roll over the link it is displaying as specified - its just the type face that is not correct!
html is out put as :
Code: Select all
<a href="showdetails.php?id=1">1 . Tom, Cull - Fiat, Punto</a><br>