rocky48 Posted December 31, 2011 Share Posted December 31, 2011 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 More sharing options...
AyKay47 Posted January 1, 2012 Share Posted January 1, 2012 you will receive more help if you post the code directly onto a thread, very few people are willing to download files from someone else. Link to comment https://forums.phpfreaks.com/topic/254132-css-not-working-in-php-script/#findComment-1302943 Share on other sites More sharing options...
rocky48 Posted January 5, 2012 Author Share Posted January 5, 2012 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 https://forums.phpfreaks.com/topic/254132-css-not-working-in-php-script/#findComment-1304564 Share on other sites More sharing options...
rocky48 Posted January 10, 2012 Author Share Posted January 10, 2012 I have partially solved this topic. I have posted a new topic in PHP Forum, as it is a PHP/HTML problem I think. Consider this closed! Link to comment https://forums.phpfreaks.com/topic/254132-css-not-working-in-php-script/#findComment-1306220 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.