php print a page bring up printer list - php

How do you bring up the printer list when you print a page in php? I've got the following code but is not bringing up the list of printers found on the pc.
echo "<a href='http://xxx/printme.php?$key' target='_blank' media='print'>Print Now</a>";

You can't do that with PHP. You need JavaScript for this:
<a href="javascript:window.print()">

You should use Javascript window.print() in an onclick event on your <a>
You can only print the current page.

Related

How to Hide Zoom links in Address bar of any Browser

I have a project were client wants to hide Shared link to their student because client thinking that student sharing their links of zoom meeting with another students of another organization.(so the client doesn't wants to share links due to client is teaching a Paid Course).
So I'm Thinking that what if we open link window as popup window.
but the problem is target=_blank and opening new window not popup windows.
how to solve this thing?
I'm using following code of php
echo "<td><a href=" . $row['r_link'] ." target=_blank>". $row['r_topic'] ."</td>";
I had Solved this Problem using iframe. iframe hides the address from the normal user (not saying from a hacker).
I added all link details in html form with input type "hidden" and posted/set target on the next page. Where php fetches parameters of link and put in iframe src tag. Code as Fallows.
in HTML
<input type=hidden name=r_id value=$id>
in next page PHP and HTML
$r_link = mysqli_real_escape_string($con,$_POST['r_id']);
<iframe src="<?php echo $r_link ?>"></iframe>
Thank You,
in this way I have solved my issue of hiding the meeting link.

PHP How to correctly echo a link?

What is the correct way to echo a link to another page in php? I have seen this used but it doesn't work?
echo "<p><a href=\"link\">";
Html in PHP
<?php
echo "<a href='$link'>The Link You Want</a>";
?>
Php in Html
Link
It seems like your question was already answered in How to create a link to another PHP page
Index Page
Page 2
If you need to pass a value -
Link that pass the value 1
You would do it like this:
print("<a href='your_target'></a>");
Or if you want to print the code and not the link:
print(htmlspecialchars("<a href='your_target'></a>"));
try this:
<a href='<?php echo "the_page_you_want.php" ?>'>link_text</a>

Use both ahref and onclick on php to hIde parameters?

I have a php function which gets data from database and calls a javasript function like this:
echo "<p>$header</p>";
The problem is when someone hovers over the link, the browser shows the complete parameters like this:(on bottom left of the browser, or a new tab)
javascript: customm('some secret code here');
Is there a way to hide this? I tried adding onclick to the php function and pointing ahref to #.
echo "<p><a href='#' onclick='javascript: customm('$variable')'>$header</a></p>";
But it didnot work.
Thanks in advance!
It's not working because you need to escape the quotes:
echo "<p><a href='#' onclick='customm(\"$variable\"); return false;'>$header</a></p>";
This code worked:
echo "<p>$header</p>";
Thanks KaeruCT and Blender!

Print to paper selected data

I've a database (image1) and using PHPMaker i created the graphic interface (image2). What i want is to add a button at the bottom of the page that will print the selected data from the selected fields (image3).
Can anyone tell me how to do that?
Do i have to use php code or a javascript?
Just add a print link by echoing the following to create a "Print" link on the page
echo "<a href='#' onclick='javascript:window.print();'>Print Page</a>";
Button click will make the browser present the user with the default print dialog.

How to "print" to a paper in PHP?

What I mean is, lets say I have a content:
"Stackoverflow is the best, bla bla bla..."
I want to print the content in a paper, not computer monitor, how to do that?
I saw a lot of CMS using php, have a print icon, and able to print it? (Well, I am not creating a CMS, just wondering how the printing works in php)
Those CMS are probably just calling the JavaScript method window.print to pop up the print dialog:
<span onclick="window.print()" class="pseudo-link">print this document</span>
The rest is then handled by the browser and operating system.
A better way to do it is like this:
Print Me
Adding the return false; to the onclick event will stop the browser following the link, and using the <a> tag with the href will cause the link cursor to appear on mouseover. Without it there would just be an arrow cursor which doesn't always make it obvious it's a link.
Do you mean printing from the Web server or from the client? If from the client window.print() in JavaScript will do the trick- http://www.javascriptkit.com/howto/newtech2.shtml.
I ask because I have seen Web based systems that actually do the printing from the server!
Printing on a client browser cannot be done by php. Its done by javascript.
<form>
<input type="button" value="Print This Page" onClick="window.print()" />
</form>
Its best to describe a print css for the page.
Use javascript for this
window.print();
window.print(): Opens the Print Dialog to print the current document.

Categories