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
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?

 

 

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.