How to get the HTML page loaded and ready before i get the code for the current page through php?How do I use PHP to get the current year?How do I get the current date and time in PHP?How do I get PHP errors to display?How to get the client IP address in PHPHow do you parse and process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How do I reformat HTML code using Sublime Text 2?Pure JavaScript equivalent of jQuery's $.ready() - how to call a function when the page/DOM is ready for itpost form data through two php pagesCannot display HTML string
Partition error (Fdisk/Parted)
Bank loan to use as proof of funds for uk visa application
Add elements inside Array conditionally in JavaScript
Flooding vs Unknown Unicast Flooding
99 coins into the sacks
Where do 5 or more U.S. counties meet in a single point?
Using mean length and mean weight to calculate mean BMI?
Why is the episode called "The Last of the Starks"?
Is the tensor product (of vector spaces) commutative?
What is the oldest instrument ever?
GLM: Modelling proportional data - account for variation in total sample size
Employee is self-centered and affects the team negatively
What's an appropriate age to involve kids in life changing decisions?
Does this website provide consistent translation into Wookiee?
My Sixteen Friendly Students
Existence of a weight of a representation in the fundamental Weyl chamber
Is your maximum jump distance halved by grappling?
How could a civilization detect tachyons?
What happens when the drag force exceeds the weight of an object falling into earth?
Learning how to read schematics, questions about fractional voltage in schematic
Is it safe to keep the GPU on 100% utilization for a very long time?
Light Switch Neutrals: Bundle all together?
How to start your Starctaft II games vs AI immediatly?
How do I give a darkroom course without negatives from the attendees?
How to get the HTML page loaded and ready before i get the code for the current page through php?
How do I use PHP to get the current year?How do I get the current date and time in PHP?How do I get PHP errors to display?How to get the client IP address in PHPHow do you parse and process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How do I reformat HTML code using Sublime Text 2?Pure JavaScript equivalent of jQuery's $.ready() - how to call a function when the page/DOM is ready for itpost form data through two php pagesCannot display HTML string
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have two pages here. I use the first page(mpdfData.php) to get the data. And I send the data to the second page(mpdfPage.php) to create a HTML page that includes the data I have sent from the first page.
The idea is to form the second page and use it to print a PDF by converting it from HTML to PDF via the PHP code in the first page.
The problem I am facing is, when I get the HTML code of the second page back to the first, the values I have sent from page one do get displayed, instead the code itself <?php echo $user?> & <?php echo $pass?> get displayed in the target PDF.
How do I over come this?
<!-- mpdfData.php -->
<?php
$html="";
if (isset($_POST['submit']))
$user=$_POST['userName'];
$pass=$_POST["password"];
?><div hidden><?php
include 'mpdfPage.php';
?><div><?php
if ($html !== '')
require_once __DIR__ . '/vendor/autoload.php';
// Create an instance of the class:
$mpdf = new MpdfMpdf();
// Write some HTML code:
$mpdf->WriteHTML($html);
// Output a PDF file directly to the browser
$mpdf->Output();
?>
<html>
<head>
<title>User Login</title>
<link rel="stylesheet" type="text/css" href="styles1.css" />
</head>
<body>
<form name="frmUser" method="post" action="">
<div class="message1"><h2>PDF PAGE:</h2></div>
<table border="0" cellpadding="10" cellspacing="1" width="500" align="center" class="tblLogin">
<tr class="tableheader">
<td align="center" colspan="2">Enter PDF Details</td>
</tr>
<tr class="tablerow">
<td>
<input type="text" name="userName" placeholder="User Name" class="login-input"></td>
</tr>
<tr class="tablerow">
<td>
<input type="password" name="password" placeholder="Password" class="login-input"></td>
</tr>
<tr class="tableheader">
<td align="center" colspan="2">
<input type="submit" name="submit" value="Print Pdf" class="btnSubmit"></td>
</tr>
</table>
</form>
</body>
</html>
<!-- mpdfPage.php -->
<html>
<head>
<style>
table
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
td, th
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
tr:nth-child(even)
background-color: #dddddd;
</style>
</head>
<body>
<h2>HTML Table</h2>
<form name="table" method="post" action="">
<table>
<tr>
<th>User Name</th>
<th>Password</th>
</tr>
<tr>
<td><?php echo $user?></td>
<td><?php echo $pass?></td>
</tr>
</table>
</form>
</body>
</html>
<?php
$html = file_get_contents(__FILE__);
?>
php html
add a comment |
I have two pages here. I use the first page(mpdfData.php) to get the data. And I send the data to the second page(mpdfPage.php) to create a HTML page that includes the data I have sent from the first page.
The idea is to form the second page and use it to print a PDF by converting it from HTML to PDF via the PHP code in the first page.
The problem I am facing is, when I get the HTML code of the second page back to the first, the values I have sent from page one do get displayed, instead the code itself <?php echo $user?> & <?php echo $pass?> get displayed in the target PDF.
How do I over come this?
<!-- mpdfData.php -->
<?php
$html="";
if (isset($_POST['submit']))
$user=$_POST['userName'];
$pass=$_POST["password"];
?><div hidden><?php
include 'mpdfPage.php';
?><div><?php
if ($html !== '')
require_once __DIR__ . '/vendor/autoload.php';
// Create an instance of the class:
$mpdf = new MpdfMpdf();
// Write some HTML code:
$mpdf->WriteHTML($html);
// Output a PDF file directly to the browser
$mpdf->Output();
?>
<html>
<head>
<title>User Login</title>
<link rel="stylesheet" type="text/css" href="styles1.css" />
</head>
<body>
<form name="frmUser" method="post" action="">
<div class="message1"><h2>PDF PAGE:</h2></div>
<table border="0" cellpadding="10" cellspacing="1" width="500" align="center" class="tblLogin">
<tr class="tableheader">
<td align="center" colspan="2">Enter PDF Details</td>
</tr>
<tr class="tablerow">
<td>
<input type="text" name="userName" placeholder="User Name" class="login-input"></td>
</tr>
<tr class="tablerow">
<td>
<input type="password" name="password" placeholder="Password" class="login-input"></td>
</tr>
<tr class="tableheader">
<td align="center" colspan="2">
<input type="submit" name="submit" value="Print Pdf" class="btnSubmit"></td>
</tr>
</table>
</form>
</body>
</html>
<!-- mpdfPage.php -->
<html>
<head>
<style>
table
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
td, th
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
tr:nth-child(even)
background-color: #dddddd;
</style>
</head>
<body>
<h2>HTML Table</h2>
<form name="table" method="post" action="">
<table>
<tr>
<th>User Name</th>
<th>Password</th>
</tr>
<tr>
<td><?php echo $user?></td>
<td><?php echo $pass?></td>
</tr>
</table>
</form>
</body>
</html>
<?php
$html = file_get_contents(__FILE__);
?>
php html
add a comment |
I have two pages here. I use the first page(mpdfData.php) to get the data. And I send the data to the second page(mpdfPage.php) to create a HTML page that includes the data I have sent from the first page.
The idea is to form the second page and use it to print a PDF by converting it from HTML to PDF via the PHP code in the first page.
The problem I am facing is, when I get the HTML code of the second page back to the first, the values I have sent from page one do get displayed, instead the code itself <?php echo $user?> & <?php echo $pass?> get displayed in the target PDF.
How do I over come this?
<!-- mpdfData.php -->
<?php
$html="";
if (isset($_POST['submit']))
$user=$_POST['userName'];
$pass=$_POST["password"];
?><div hidden><?php
include 'mpdfPage.php';
?><div><?php
if ($html !== '')
require_once __DIR__ . '/vendor/autoload.php';
// Create an instance of the class:
$mpdf = new MpdfMpdf();
// Write some HTML code:
$mpdf->WriteHTML($html);
// Output a PDF file directly to the browser
$mpdf->Output();
?>
<html>
<head>
<title>User Login</title>
<link rel="stylesheet" type="text/css" href="styles1.css" />
</head>
<body>
<form name="frmUser" method="post" action="">
<div class="message1"><h2>PDF PAGE:</h2></div>
<table border="0" cellpadding="10" cellspacing="1" width="500" align="center" class="tblLogin">
<tr class="tableheader">
<td align="center" colspan="2">Enter PDF Details</td>
</tr>
<tr class="tablerow">
<td>
<input type="text" name="userName" placeholder="User Name" class="login-input"></td>
</tr>
<tr class="tablerow">
<td>
<input type="password" name="password" placeholder="Password" class="login-input"></td>
</tr>
<tr class="tableheader">
<td align="center" colspan="2">
<input type="submit" name="submit" value="Print Pdf" class="btnSubmit"></td>
</tr>
</table>
</form>
</body>
</html>
<!-- mpdfPage.php -->
<html>
<head>
<style>
table
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
td, th
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
tr:nth-child(even)
background-color: #dddddd;
</style>
</head>
<body>
<h2>HTML Table</h2>
<form name="table" method="post" action="">
<table>
<tr>
<th>User Name</th>
<th>Password</th>
</tr>
<tr>
<td><?php echo $user?></td>
<td><?php echo $pass?></td>
</tr>
</table>
</form>
</body>
</html>
<?php
$html = file_get_contents(__FILE__);
?>
php html
I have two pages here. I use the first page(mpdfData.php) to get the data. And I send the data to the second page(mpdfPage.php) to create a HTML page that includes the data I have sent from the first page.
The idea is to form the second page and use it to print a PDF by converting it from HTML to PDF via the PHP code in the first page.
The problem I am facing is, when I get the HTML code of the second page back to the first, the values I have sent from page one do get displayed, instead the code itself <?php echo $user?> & <?php echo $pass?> get displayed in the target PDF.
How do I over come this?
<!-- mpdfData.php -->
<?php
$html="";
if (isset($_POST['submit']))
$user=$_POST['userName'];
$pass=$_POST["password"];
?><div hidden><?php
include 'mpdfPage.php';
?><div><?php
if ($html !== '')
require_once __DIR__ . '/vendor/autoload.php';
// Create an instance of the class:
$mpdf = new MpdfMpdf();
// Write some HTML code:
$mpdf->WriteHTML($html);
// Output a PDF file directly to the browser
$mpdf->Output();
?>
<html>
<head>
<title>User Login</title>
<link rel="stylesheet" type="text/css" href="styles1.css" />
</head>
<body>
<form name="frmUser" method="post" action="">
<div class="message1"><h2>PDF PAGE:</h2></div>
<table border="0" cellpadding="10" cellspacing="1" width="500" align="center" class="tblLogin">
<tr class="tableheader">
<td align="center" colspan="2">Enter PDF Details</td>
</tr>
<tr class="tablerow">
<td>
<input type="text" name="userName" placeholder="User Name" class="login-input"></td>
</tr>
<tr class="tablerow">
<td>
<input type="password" name="password" placeholder="Password" class="login-input"></td>
</tr>
<tr class="tableheader">
<td align="center" colspan="2">
<input type="submit" name="submit" value="Print Pdf" class="btnSubmit"></td>
</tr>
</table>
</form>
</body>
</html>
<!-- mpdfPage.php -->
<html>
<head>
<style>
table
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
td, th
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
tr:nth-child(even)
background-color: #dddddd;
</style>
</head>
<body>
<h2>HTML Table</h2>
<form name="table" method="post" action="">
<table>
<tr>
<th>User Name</th>
<th>Password</th>
</tr>
<tr>
<td><?php echo $user?></td>
<td><?php echo $pass?></td>
</tr>
</table>
</form>
</body>
</html>
<?php
$html = file_get_contents(__FILE__);
?>
php html
php html
asked Mar 23 at 7:26
GauthamKGauthamK
124
124
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The problem you are getting because of the file_get_contents(__FILE__) don't execute the PHP code and it will provide raw contents of the file.
You can achieve that using the following way.
<?php ob_start(); ?>
<html>
<head>
<style>
table
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
td, th
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
tr:nth-child(even)
background-color: #dddddd;
</style>
</head>
<body>
<h2>HTML Table</h2>
<form name="table" method="post" action="">
<table>
<tr>
<th>User Name</th>
<th>Password</th>
</tr>
<tr>
<td><?php echo $user?></td>
<td><?php echo $pass?></td>
</tr>
</table>
</form>
</body>
</html>
<?php $html = ob_get_clean(); ?>
This solved my problem. Thank you.
– GauthamK
Mar 23 at 10:09
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55311594%2fhow-to-get-the-html-page-loaded-and-ready-before-i-get-the-code-for-the-current%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem you are getting because of the file_get_contents(__FILE__) don't execute the PHP code and it will provide raw contents of the file.
You can achieve that using the following way.
<?php ob_start(); ?>
<html>
<head>
<style>
table
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
td, th
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
tr:nth-child(even)
background-color: #dddddd;
</style>
</head>
<body>
<h2>HTML Table</h2>
<form name="table" method="post" action="">
<table>
<tr>
<th>User Name</th>
<th>Password</th>
</tr>
<tr>
<td><?php echo $user?></td>
<td><?php echo $pass?></td>
</tr>
</table>
</form>
</body>
</html>
<?php $html = ob_get_clean(); ?>
This solved my problem. Thank you.
– GauthamK
Mar 23 at 10:09
add a comment |
The problem you are getting because of the file_get_contents(__FILE__) don't execute the PHP code and it will provide raw contents of the file.
You can achieve that using the following way.
<?php ob_start(); ?>
<html>
<head>
<style>
table
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
td, th
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
tr:nth-child(even)
background-color: #dddddd;
</style>
</head>
<body>
<h2>HTML Table</h2>
<form name="table" method="post" action="">
<table>
<tr>
<th>User Name</th>
<th>Password</th>
</tr>
<tr>
<td><?php echo $user?></td>
<td><?php echo $pass?></td>
</tr>
</table>
</form>
</body>
</html>
<?php $html = ob_get_clean(); ?>
This solved my problem. Thank you.
– GauthamK
Mar 23 at 10:09
add a comment |
The problem you are getting because of the file_get_contents(__FILE__) don't execute the PHP code and it will provide raw contents of the file.
You can achieve that using the following way.
<?php ob_start(); ?>
<html>
<head>
<style>
table
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
td, th
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
tr:nth-child(even)
background-color: #dddddd;
</style>
</head>
<body>
<h2>HTML Table</h2>
<form name="table" method="post" action="">
<table>
<tr>
<th>User Name</th>
<th>Password</th>
</tr>
<tr>
<td><?php echo $user?></td>
<td><?php echo $pass?></td>
</tr>
</table>
</form>
</body>
</html>
<?php $html = ob_get_clean(); ?>
The problem you are getting because of the file_get_contents(__FILE__) don't execute the PHP code and it will provide raw contents of the file.
You can achieve that using the following way.
<?php ob_start(); ?>
<html>
<head>
<style>
table
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
td, th
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
tr:nth-child(even)
background-color: #dddddd;
</style>
</head>
<body>
<h2>HTML Table</h2>
<form name="table" method="post" action="">
<table>
<tr>
<th>User Name</th>
<th>Password</th>
</tr>
<tr>
<td><?php echo $user?></td>
<td><?php echo $pass?></td>
</tr>
</table>
</form>
</body>
</html>
<?php $html = ob_get_clean(); ?>
answered Mar 23 at 7:56
RopAli MunshiRopAli Munshi
800518
800518
This solved my problem. Thank you.
– GauthamK
Mar 23 at 10:09
add a comment |
This solved my problem. Thank you.
– GauthamK
Mar 23 at 10:09
This solved my problem. Thank you.
– GauthamK
Mar 23 at 10:09
This solved my problem. Thank you.
– GauthamK
Mar 23 at 10:09
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55311594%2fhow-to-get-the-html-page-loaded-and-ready-before-i-get-the-code-for-the-current%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown