How to put a table in the end of the content - php

okay, so my head is going to explode right now, i'm searching 5 hours non stop for my problem..
i want the menu2.html which is inside a table, to appear on the end of the page, After the end of the Content!
i tried a lot, like:
1-position: absolute; bottom: 0;
2-position: absolute; left: 100px; top: 150px; etc etc...
But this is not what im looking for!
I could put the menu2 after the content only by editing the top:150 But there are a lot of pages with different contents, so the menu2 doesn't suit in the other pages!
I hope you can help me.
This Is My PHP file:
<style type="text/css">
.menu2 {
background-image: url('<?=$profpic;?>');
background-attachment:fixed;
background: yellow;
}
</style>
<title>Hello</title>
</head>
<body>
<table width="100%" height="58%" border="0" cellspacing="0" cellpadding="2" class="heading">
<tr>
<td>
<?php include('menu.html');?>
</td>
</tr>
<tr>
<td><img src="pictures/logo.png" width="1335" height="300"></td>
</tr>
</table>
<table width="85%" height="1%" border="1" cellspacing="0" cellpadding="2">
<tr>
<td>
<?php include('menu2.php');?>
</td>
</tr>
</table>
<?php
$profpic = "pictures/bg.jpg";
?>
</body>
</html>

It's not clear to me what you are trying to do here, but I'll take a shot at helping you. First of all, you can't have multiple <html>, <head>, and <body> tags on the same page. Only one set of these are allowed. Secondly, change the file type of menu2 to php instead of html if you want to include it there.
<style type="text/css">
.menu2 {
background-image: url('<?=$profpic;?>');
background-attachment:fixed;
position: absolute;
background: yellow;
}
</style>
<title>Hello</title>
</head>
<body>
<table width="100%" height="58%" border="0" cellspacing="0" cellpadding="2" class="heading">
<tr>
<td>
<?php include('menu.html');?>
</td>
</tr>
<tr>
<td><img src="pictures/logo.png" width="1335" height="300"></td>
</tr>
</table>
<table width="85%" height="1%" border="1" cellspacing="0" cellpadding="2">
<tr>
<td>
<?php include('menu2.php');?>
</td>
</tr>
</table>
<?php
$profpic = "pictures/bg.jpg";
?>
</body>
</html>
menu2.php
<div class="menu2">
//menu2 contents
</div>

Related

How to display same margin on second page when printing a page using HTML and CSS?

This is my code. When I print this page the heading and name are OK on the first sheet, but on the second sheet the heading is not displayed properly.
Is there any other technique to do this?
<html>
<head>
<style>
.my-header {
background: #e3dcf9;
height: 40px;
top: 0;
left: 0;
position: fixed;
right: 0;
}
thead { display:table-header-group }
</style>
</head>
<body>
<div class="my-header">This is header</div>
<div style="margin-top:100px;position: relative;">
<table border="1" >
<thead>
<tr>
<th>Number</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<?php
for($i=1;$i<=150;$i++)
{
?>
<tr>
<td><?php echo $i;?></td>
<td>Content</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</body>
</html>
mail and print template doesn't support internal css and external css.use inline css for proper result.Don't use internal or external css.

Apache access to php for python script doesn't work

I know that there are many similar questions and solutions available everywhere for this situation. Apology for the repetition, let me describe my pain:
All efforts to give permission to python script for php based web access goes in vain. No any kind of permission works in my situation:
<html>
<head>
<?php
if (isset($_POST['CronON']))
{
exec("sudo python /var/www/cron_on.py");
}
if (isset($_POST['CronOFF']))
{
exec("sudo python /var/www/cron_off.py");
}
?>
<title></title>
</head>
<body>
<form method="post">
<table
style="width: 75%; text-align: left; margin-left: auto; margin-right: auto;"
border="0" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td style="text-align: center;">CRON ON</td>
<td style="text-align: center;">CRON OFF</td>
</tr>
<tr>
<td style="text-align: center;"><button name="CronON">ON</button></td>
<td style="text-align: center;"><button name="CronOFF">OFF</button></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
Pressing the button doesn't product any output, no change at all. This question is a follow-up from my previous question: How to tell python not to interpret hash symbol as comment?

How to display a Japanese string inside HTML?

I am creating a PDF using DOMPDF. The pdf contains some images and strings. I am printing this values as php variables inside my HTML Layout and then converting HTML to PDF. Some of my strings are in Japanese. But it rendering in PDF as ????.
I used <meta http-equiv="Content-Type" content="text/html; charset=utf-8">. But nothing happends..
My code used is..
$bio_tbl = '<html style="margin:20px 20px 0px; padding:0;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="margin:0; padding:0;">
<table style="vertical-align: top;">
<tr>
<td style="vertical-align: top;padding-top:4px;">'.$model_first_img.'</td>
<td style="vertical-align:top;">
<table style="margin:0px 0px 5px 3px;">
<tr>
<td style="width:220px;vertical-align:top;">'.$model_second_img.'</td>
<td style="width:220px;vertical-align:top;">'.$model_third_img.'</td>
</tr>
</table>
<table style="margin:0px 0px 5px 3px;">
<tr>
<td style="width:220px;vertical-align:top;">'.$model_forth_img.'</td>
<td style="width:220px;vertical-align:top;">'.$model_fifth_img.'</td>
</tr>
</table>
<table style="margin:0px 0px 0px 3px;">
<tr>
<td style="width:220px;vertical-align:top;">'.$text.'</td>
<td style="width:220px;vertical-align:top;"><img style="width:210px;height:210px;" src="'.$black_image_path.'"></td>
</tr>
</table>
</td>
<td>
<img src="'.$copy_img.'">
</td>
</tr>
<tr>
<td style="vertical-align:top;text-align:center;font-size:20px;margin-top:5px"><b><u>BIO</u></b></td>
</tr>
<tr>
<td style="vertical-align:top;">
<div style="text-align:left;font-size:14px; margin-bottom:10px; margin-top:10px;">'.$bio_text.'</div>
</td>
</tr>
</table>
</body>
</html>';
Converting to PDF using following code..
$dompdf = new DOMPDF();
$dompdf->set_base_path($path);
$dompdf->load_html($bio_tbl);
$dompdf->set_paper("a3", "portrait");
$dompdf->render();
$pdf = $dompdf->output();
$filename = $pdfname;
$dir = DRUPAL_ROOT .'/sites/default/files/temp_pdf/bio_'.$filename;
file_put_contents($dir,$pdf);
All helps appreciated..
Try to use :
$dompdf->load_html($content, 'UTF-8');

php parse/syntax error help

I keep getting a
"Parse error: syntax error, unexpected ':', expecting ')' in /home/jobkill/public_html/process.php on line 8"
when processing inputs from a page that redirects here. I dont know what to fix,
Here's the code:
<?
$aff = $_GET['aff'] ;
$click_id = $_GET['click_id'] ;
$zipcode = #$_GET['zip'];
$state = #$_GET['custom_state'];
$subid = $_GET['subid'] ;
$urls = array(
“http://consumerheadlinesdaily.com/debt/direct_2de89f.php?
cdb=23&zip=<?print $zipcode?>”,
“http://consumerheadlinesdaily.com/debt/direct_2de89f.php?
cdb=80&zip=<?print $zipcode?>”,
“http://consumerheadlinesdaily.com/debt/direct_2de89f.php?
cdb=46&zip=<?print $zipcode?>”,
“http://consumerheadlinesdaily.com/debt/direct_2de89f.php?
cdb=37&zip=<?print $zipcode?>”,
“http://consumerheadlinesdaily.com/debt/direct_2de89f.php?
cdb=55&zip=<?print $zipcode?>”,
“http://consumerheadlinesdaily.com/debt/direct_2de89f.php?
cdb=71&zip=<?print $zipcode?>”);
$url = $urls[array_rand($urls)];
echo “<meta http-equiv=\"refresh\" content=3; url='$url'>”;
?>
<html>
<HEAD>
<LINK href="./index_files/style2.css" rel="stylesheet" type="text/css">
<STYLE>
#middlename
{
display:none;
visibility:hidden;
}
</STYLE>
<SCRIPT type="text/javascript" src="./index_files/scripts.js"></SCRIPT>
<SCRIPT type="text/javascript"
src="./index_files/functions.js"></SCRIPT>
<script language="JavaScript"
src="http://j.maxmind.com/app/geoip.js"></script>
</HEAD><BODY>
<DIV id="form_complete">
<!-- OPEN MAIN TABLE -->
<TABLE width="100%" height="850" border="0" align="center"
cellpadding="0" cellspacing="0" class="tablebg2">
<TBODY>
<TR>
<TD valign="top" align="center">
<!-- OPEN PLACEMENT TABLE -->
<table width="1010" height="500" border="0" cellspacing="0"
cellpadding="0">
<tr><td height="220" colspan="3"> </td></tr>
<tr>
<td width="51%"><div align="center"><img
src="index_files/blank.gif" border="0" width="425" height="344"
/></div></td>
<td
width="10%"> &nbsp
; </td
>
<td width="39%" align="left">
<br /><br /><br />
<div id="super-container0">
<div id="wrapper">
<span style="color:#000000;font-weight:bold;font-
size:24px;color:#898;">Now Searching...</span><br /><span
style="color:#000000;font-weight:bold;font-size:32px;"><script
language="Javascript">document.write(geoip_city());</script>, <script
language="Javascript">document.write(geoip_region());</script></span>
<!-- <h2>for <span style="color:#000000;font-weight:bold">30-
34</span> Year Old <span style="color:#000000;font-
weight:bold">Male</span> Drivers</h2> -->
<div id="block"></div>
<div id="progress-bar"><img src="index_files/progress.gif"></div>
</div>
</div>
</DIV>
</td>
</tr>
<tr>
<td height="350" colspan="3"> </td>
</tr>
<tr>
<td colspan="3">
<DIV class="Privacy" style="width: 1000px; margin: 0 auto;">
<P style="font-family:Arial, Helvetica, sans-serif; font-
size:11px; margin: 0px; padding: 0px;">All personal information and
email addresses are kept confidential. By
submitting your expression of interest you are consenting to receive
telephone calls from our participating partners even if you have been
previously listed on a state or federal Do-Not-Call List.
</P><P style="width: 1000px; text-align: center; margin-top: 0px;
padding-top: 0px;"><A href="#" onclick="MM_openBrWindow
('privacy.htm','','scrollbars=yes,width=500,height=
400')" target="_blank" style="font-family:Arial, Helvetica, sans-
serif; font-size:10px; color:#03C">Privacy Policy</A></P>
</DIV></td>
</tr>
</table> <!-- CLOSE PLACEMENT TABLE -->
</TD></TR></TABLE> <!-- CLOSE MAIN TABLE -->
<DIV id="processing" style="display:none">
<br /><br /><br /><br />
<CENTER><img src="./index_files/logo2.gif" /><br /><br />
<H2>Searching for a specialist now ...<BR>Thank you for giving us an
opportunity to assist you today.</H2><STRONG>(Please do not Refresh
page as that will result in an error in the system.)</STRONG><BR>
<IMG src="./index_files/ajax-loader.gif" width="220" height="19"
alt="Processing">
</CENTER>
</DIV>
</BODY></html>
The problem in your code are the quotes.
This character:
“
Is not recognised as a quotation in PHP, you need to use
'
Or
"
Here is the updated code
<?
$aff = $_GET['aff'] ;
$click_id = $_GET['click_id'] ;
$subid = $_GET['subid'];
$zipcode = '';
if (isset($_GET['zip']) {
$zipcode = $_GET['zip'];
}
$state = '';
if (isset($_GET['custom_state']) {
$state = $_GET['custom_state'];
}
$urls = array(
'http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=23&zip=' . $zipcode,
'http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=80&zip=' . $zipcode,
'http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=46&zip=' . $zipcode,
'http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=37&zip=' . $zipcode,
'http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=55&zip=' . $zipcode,
'http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=71&zip=' . $zipcode);
$url = $urls[array_rand($urls)];
?>
<html>
<head>
<meta http-equiv="refresh" content=3; url='<? echo $url ?>'>
<link href="./index_files/style2.css" rel="stylesheet" type="text/css">
<style>
#middlename
{
display:none;
visibility:hidden;
}
</style>
<script type="text/javascript" src="./index_files/scripts.js"></script>
<script type="text/javascript" src="./index_files/functions.js"></script>
<script type="text/javascript" src="http://j.maxmind.com/app/geoip.js"></script>
</head>
<body>
<div id="form_complete">
<!-- OPEN MAIN TABLE -->
<table width="100%" height="850" border="0" align="center" cellpadding="0" cellspacing="0" class="tablebg2">
<tbody>
<tr>
<td valign="top" align="center">
<!-- OPEN PLACEMENT TABLE -->
<table width="1010" height="500" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="220" colspan="3"> </td>
</tr>
<tr>
<td width="51%">
<div align="center">
<img src="index_files/blank.gif" border="0" width="425" height="344" />
</div>
</td>
<td width="10%">
</td>
<td width="39%" align="left">
<br /><br /><br />
<div id="super-container0">
<div id="wrapper">
<span style="color:#000000;font-weight:bold;font-size:24px;color:#898;">Now Searching...</span><br />
<span style="color:#000000;font-weight:bold;font-size:32px;">
<script type="text/javascript">document.write(geoip_city());</script>,
<script type="text/javascript">document.write(geoip_region());</script>
</span>
<!-- <h2>for <span style="color:#000000;font-weight:bold">30-34</span> Year Old
<span style="color:#000000;font-weight:bold">Male</span> Drivers</h2> -->
<div id="block"></div>
<div id="progress-bar"><img src="index_files/progress.gif"></div>
</div>
</div>
</td>
</tr>
<tr>
<td height="350" colspan="3"> </td>
</tr>
<tr>
<td colspan="3">
<div class="Privacy" style="width: 1000px; margin: 0 auto;">
<p style="font-family:Arial, Helvetica, sans-serif; font-size:11px; margin: 0px; padding: 0px;">All personal information and
email addresses are kept confidential. By submitting your expression of interest you are consenting to receive
telephone calls from our participating partners even if you have been
previously listed on a state or federal Do-Not-Call List.</p>
<p style="width: 1000px; text-align: center; margin-top: 0px; padding-top: 0px;">Privacy Policy</p>
</div>
</td>
</tr>
</table> <!-- CLOSE PLACEMENT TABLE -->
</td>
</tr>
</tbody>
</table> <!-- CLOSE MAIN TABLE -->
</div>
<div id="processing" style="display:none">
<br /><br /><br /><br />
<center>
<img src="./index_files/logo2.gif" /><br /><br />
<H2>Searching for a specialist now ...<BR>Thank you for giving us an opportunity to assist you today.</h2>
<strong>(Please do not Refresh page as that will result in an error in the system.)</strong><br>
<img src="./index_files/ajax-loader.gif" width="220" height="19" alt="Processing">
</center>
</div>
</body>
</html>
I have also...
Fixed a couple of HTML errors, with missing closing tags or bad nesting
Rather than using error suppression in PHP (#$_GET['mightnotexist']) I have performed an isset($_GET['mightnotexist']) check
I have normalised the script tags
But I haven't...
Removed the tables being used for layout
Moved the inline styles into the stylesheet
UPDATE:
added whole code, tested and working
replace <?print $zipcode?> with $zipcode
i.e. “http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=23&zip=<?print $zipcode?>”,
into “http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=23&zip=$zipcode”,
and replace quotation marks (“”) to normal ones ("")
basically your code should look like this:
<?php
$aff = $_GET['aff'] ;
$click_id = $_GET['click_id'] ;
$zipcode = #$_GET['zip'];
$state = #$_GET['custom_state'];
$subid = $_GET['subid'] ;
$urls = array(
"http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=23&zip=$zipcode",
"http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=80&zip=$zipcode",
"http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=46&zip=$zipcode",
"http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=37&zip=$zipcode",
"http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=55&zip=$zipcode",
"http://consumerheadlinesdaily.com/debt/direct_2de89f.php?cdb=71&zip=$zipcode");
$url = $urls[array_rand($urls)];
?>
<html>
<HEAD>
<LINK href="./index_files/style2.css" rel="stylesheet" type="text/css">
<STYLE>
#middlename
{
display:none;
visibility:hidden;
}
</STYLE>
<SCRIPT type="text/javascript" src="./index_files/scripts.js"></SCRIPT>
<SCRIPT type="text/javascript"
src="./index_files/functions.js"></SCRIPT>
<script language="JavaScript"
src="http://j.maxmind.com/app/geoip.js"></script>
<meta http-equiv="refresh" content="3;url=<?php echo $url; ?>">
</HEAD><BODY>
<DIV id="form_complete">
<!-- OPEN MAIN TABLE -->
<TABLE width="100%" height="850" border="0" align="center"
cellpadding="0" cellspacing="0" class="tablebg2">
<TBODY>
<TR>
<TD valign="top" align="center">
<!-- OPEN PLACEMENT TABLE -->
<table width="1010" height="500" border="0" cellspacing="0"
cellpadding="0">
<tr><td height="220" colspan="3"> </td></tr>
<tr>
<td width="51%"><div align="center"><img
src="index_files/blank.gif" border="0" width="425" height="344"
/></div></td>
<td
width="10%"> &nbsp
; </td
>
<td width="39%" align="left">
<br /><br /><br />
<div id="super-container0">
<div id="wrapper">
<span style="color:#000000;font-weight:bold;font-
size:24px;color:#898;">Now Searching...</span><br /><span
style="color:#000000;font-weight:bold;font-size:32px;"><script
language="Javascript">document.write(geoip_city());</script>, <script
language="Javascript">document.write(geoip_region());</script></span>
<!-- <h2>for <span style="color:#000000;font-weight:bold">30-
34</span> Year Old <span style="color:#000000;font-
weight:bold">Male</span> Drivers</h2> -->
<div id="block"></div>
<div id="progress-bar"><img src="index_files/progress.gif"></div>
</div>
</div>
</DIV>
</td>
</tr>
<tr>
<td height="350" colspan="3"> </td>
</tr>
<tr>
<td colspan="3">
<DIV class="Privacy" style="width: 1000px; margin: 0 auto;">
<P style="font-family:Arial, Helvetica, sans-serif; font-
size:11px; margin: 0px; padding: 0px;">All personal information and
email addresses are kept confidential. By
submitting your expression of interest you are consenting to receive
telephone calls from our participating partners even if you have been
previously listed on a state or federal Do-Not-Call List.
</P><P style="width: 1000px; text-align: center; margin-top: 0px;
padding-top: 0px;"><A href="#" onclick="MM_openBrWindow
('privacy.htm','','scrollbars=yes,width=500,height=
400')" target="_blank" style="font-family:Arial, Helvetica, sans-
serif; font-size:10px; color:#03C">Privacy Policy</A></P>
</DIV></td>
</tr>
</table> <!-- CLOSE PLACEMENT TABLE -->
</TD></TR></TABLE> <!-- CLOSE MAIN TABLE -->
<DIV id="processing" style="display:none">
<br /><br /><br /><br />
<CENTER><img src="./index_files/logo2.gif" /><br /><br />
<H2>Searching for a specialist now ...<BR>Thank you for giving us an
opportunity to assist you today.</H2><STRONG>(Please do not Refresh
page as that will result in an error in the system.)</STRONG><BR>
<IMG src="./index_files/ajax-loader.gif" width="220" height="19"
alt="Processing">
</CENTER>
</DIV>
</BODY></html>
replace "refresh" in your echo with \"refresh\"
and
<?print $zipcode?>
in array with
$zipcode
Update:
Checked your code and was able to reproduce your error. You're not using double quotes but some other obscure quotes that is not supported by PHP.
Proper double quotes are literally ". You can learn about the details in the PHP manual.
You probably made an error while copy and pasting code from somewhere else in the internet that was changing code's quote's on the fly for styling and display reason.
Take care. The other problems in your code still stand (see other answers as well).
Try
echo "<meta http-equiv=\"refresh\" content=\"3; url='$url'\">";
instead of the similar but different line in your screenshot (it's no text, so I can't quote it and highlight the places you made errors in there, so sorry 'bout that).
This does not create the syntax error you're asking about however.

How to center html table?

Trying to create proper PDF document, using PHP and TCPDF.
Can you help me, how can I use writeHTML function to create and center table, in TCPDF?
Tryed with:
$html = '
<div style="margin-left: auto; margin-right: auto; width: 50%">
<table border="1" width="200" align="center"><tr><td><b>Invoice number: '.$this->xInvoiceNumber.'</b></td></tr></table>
<br />
<table border="1" width="200" align="center"><tr><td>'.$this->xClient.'</td></tr></table>
<br />
</div>
... but no luck.
You have to make a table with 3 columns, set the width for every one of them and in the middle one you have to create your table.
<table>
<tr>
<td style="width:25%"></td>
<td style="width:50%"><table><tr><td>Your content</td></tr></table></td>
<td style="width:25%"></td>
</tr>
</table>
I'm not proud of this method but it's working :)
Ok, so I don't know if there is solution for my problem...
However, I did manage to solve it by using writeHTMLCell funcion, ie.
$this->writeHTMLCell(50, 0, 50, 50, 'cellcontent', 'LRTB', 1, 0, true, 'L');
If somebody can find better solution, please reply.
Tnx!
Try this code; it worked for me:
<table style="width:100%">
<tr>
<td style="width:30%">left margin</td>
<td style="width:40%">
<table border="1" style="width:100%">
<thead>
<tr>
<td style="width:100%" colspan="2"></td>
</tr>
<tr>
<td style="width:40%"><b></b></td>
<td style="width:60%"><b></b></td>
</tr>
</thead>
</table>
</td>
<td style="width:30%">rigth margin</td>
</tr>
</table>
Try replacing your opening div tag with this...
<div style="margin:5px auto; width:50%">
Never done anything like this however, this is the code you would need to center a table that is the cross browser compatible
<div style="text:align:center;">
<table style="margin:0px auto" border="1" width="200" align="center">
<tr>
<td><b>Invoice number: </b></td>
</tr>
</table>
<br />
<table style="margin:0px auto"border="1" width="200" align="center">
<tr>
<td>Client</td>
</tr>
</table>
<br />
</div>
If pdfs support css i would advise styling the html elements using css
table{
border:1px solid black;
margin:0px auto;
text-align:center;
width:200px;
}
Hope this helps!

Categories