I have create a web page in php.
I am retrieving the values from mysql database and showing as grid view on page.
I want to take a print on paper upto only datagrid.
What to do..?
Please help anyone with code....

Recommended Answers

All 2 Replies

use php code header

<head>
----
----
<script type="text/javascript">
function report()
{
var WinPrint = window.open('', '', 'left=0,top=0,width=1024,height=768,toolbar=0,scrollbars=0,status=0');
				
				var id=document.getElementById('report');
				
				var str='<html><body><table width="100%">'+id.innerHTML+'</table></body></html>';
				
				WinPrint.document.write(str);
				
				WinPrint.document.close();
				
				WinPrint.focus();
				
				WinPrint.print();
				
				WinPrint.close();
			}
</script>
----
----
</head>
----
----

<div id="report">
//Your grid view result here
</div>
<a href="javascript:void(0)" onclick="javascript:report();">Print</a>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.