Jump to content

CSS not working in PHP script


rocky48

Recommended Posts

I am trying to create an output for a printer, for a string that is queried from an SQL database.

I am using PHP to query the database and the result is passed to a variable called $display block.

I want to be able to define the Font face and the Font size.

 

I have tried 2 methods to implement CSS for this code but niether work.

I am relitively new to programming and have exhusted all of the avenues to resolve this.

PrnScrn.php - External CSS file

PrnScrn1.php - embeded CSS file

Prn_Scrn.css.zip - zipped version of CSS external file

 

I would be most appreciative if someone could advise where I am going wrong!

 

Rocky48

17220_.php

17221_.php

17222_.zip

Link to comment
https://forums.phpfreaks.com/topic/254132-css-not-working-in-php-script/
Share on other sites

Here are the scripts:

PrnScrn.php

 

<?php
include("Loc_cverse_connect.php");
doDB();

//verify the Event exists
$Get_Verse_sql = "SELECT ID, Event, Sub_Type, Verse FROM verses WHERE ID = '".$_POST["ID"]."'";
$Get_Verse_res =  mysqli_query($mysqli, $Get_Verse_sql) or die(mysqli_error($mysqli));

//echo $_POST[iD];

if (mysqli_num_rows($Get_Verse_res) < 1) {
//this Event does not exist
$display_block = "<p><em>You have selected an invalid Event.<br/>
Please try again.</em></p>";
} else {
//get the Event ID
while ($Verse_info = mysqli_fetch_array($Get_Verse_res)) {
	$Verse = stripslashes($Verse_info['Verse']);
}
	//create the display string
$display_block = "<h1>$Verse</h1>";
//free results
mysqli_free_result($get_Verse_res);

//close connection to MySQL
mysqli_close($mysqli);
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="Prn_Scrn.css" media="all">
<title> List of Verses</title>
</head>
<body>

<?php

ECHO $display_block;

?>

</body>
</html>

 

PrnScrn1.php

 

<?php
include("Loc_cverse_connect.php");
doDB();

//verify the Event exists
$Get_Verse_sql = "SELECT ID, Event, Sub_Type, Verse FROM verses WHERE ID = '".$_POST["ID"]."'";
$Get_Verse_res =  mysqli_query($mysqli, $Get_Verse_sql) or die(mysqli_error($mysqli));

//echo $_POST[iD];

if (mysqli_num_rows($Get_Verse_res) < 1) {
//this Event does not exist
$display_block = "<p><em>You have selected an invalid Event.<br/>
Please try again.</em></p>";
} else {
//get the Event ID
while ($Verse_info = mysqli_fetch_array($Get_Verse_res)) {
	$Verse = stripslashes($Verse_info['Verse']);
}
	//create the display string
$display_block = "<h1>$Verse</h1>";

//free results
mysqli_free_result($get_Verse_res);

//close connection to MySQL
mysqli_close($mysqli);
}
?>
<html>
<head>
<style type="text/css">
body{
background-color: #FFFFFF;
h1 {font-family:Arial, sans-serif; font-size:x-large;}
}
</style>

<title> Print Verse</title>
</head>
<body>

<?php

ECHO $display_block;

?>

</body>
</html>

 

Prn_Scrn.css

 

/*--- Page Style ---*/

       @page {size:landscape; margin-left: 175mm; margin-top: 55mm}

       h1 {font: large Ariel; color: Black;}

/*--- EndOfFile ---*/

 

Any ideas why either of these do not work?

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.