Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/254739-php-inside-a-html-body/
Share on other sites

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

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.