rocky48 Posted January 10, 2012 Share Posted January 10, 2012 I am trying to format for printing some text which I have queried from a MySQL database. I have written 2 CSS scripts one for screen and the other for printing. They work up to a point, but I can't get it to display the correct font and font size. I am sure it is because it is ignoring the <p>. Here is the source script: <?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="screen"> <link rel="stylesheet" type="text/css" href="print.css" media="print"> <title> List of Verses</title> </head> <body {page: land}> <div id="Text" align="center"> <p> <?php ECHO $display_block; ?> </p> </div> </body> </html> Here is the print CSS script: /*--Print stylesheet*/ p {font: 25pt French Script MT;} @page land {size: landscape;margin: 0in} div#Text { /* <DIV>Text</DIV> */ position : absolute; left : 6.9in; top : 2.25in; width : 3.625in; height : 1.625in; } Here is the screen CSS: /*--- Page Style ---*/ @page land {size:landscape; margin: 0in;} p {font: 25pt French Script MT;} div#Text { /* <DIV>Text</DIV> */ position : absolute; left : 6.9in; top : 2.25in; width : 3.625in; height : 1.625in; } /*--- EndOfFile ---*/ Where am I going wrong? Rocky48 Quote Link to comment https://forums.phpfreaks.com/topic/254739-php-inside-a-html-body/ Share on other sites More sharing options...
Pikachu2000 Posted January 10, 2012 Share Posted January 10, 2012 When posting code, enclose it within the forum's . . . BBCode tags. Quote Link to comment https://forums.phpfreaks.com/topic/254739-php-inside-a-html-body/#findComment-1306236 Share on other sites More sharing options...
rocky48 Posted January 12, 2012 Author Share Posted January 12, 2012 I have sussed out the problem that it was ignoring the CSS completely by including in the DIV#text class, but it is ignoring the @page directive in the HTML. I am not sure if I have got the syntax correct in the HTML. The book I am reading says body {page: Port;} Does this mean that after the <body> you add the statement or have I got this wrong? Rocky48 Quote Link to comment https://forums.phpfreaks.com/topic/254739-php-inside-a-html-body/#findComment-1307009 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.