jquery validation ? - php

The plugin works in all other pages in all browsers. In this page plugin working only in IE9 and not in FF, Chrome. In FF, Chrome the form is getting submitted with errors.
i should send my html...i am include my jquery validation but still not working?
<script src="../inc/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
<script src="../inc/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
if page is loded alert working properly... then i should click button there are nor working validation..but file should be exit...
<script type="text/javascript">
$(document).ready(function(){
alert("test");
// binds form submission and fields to the validation engine
$("#form_page").validationEngine();
});
</script>
i also send html
<form name="form_page" id="form_page" enctype="multipart/form-data" method="post" action="/1MP1/ap/manufacturer_edit.php">
<td>
<div class="error_box">
<div class="error_msg">
<img src="images/remove.png" alt=""/>
</div>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr height="50px">
<td width="29%" style="border-bottom:1px solid #e9eaeb; border-top:1px solid #e9eaeb;" align="right"><span class="addedittitles">Manufacturer Name</span></td>
<td width="71%" style="border-bottom:1px solid #e9eaeb; border-top:1px solid #e9eaeb;"><span style="border-bottom:1px solid #e9eaeb;"><span class="faq_colomn_right">
<input name="mfgName" type="text" id="mfgName" class="validate[required,maxSize[250]]" value="" maxlength="250" style="width:85%; border:1px solid #cdcdcf; height:22px;"/>
</span>
</span></td>
</tr>
<tr>
<td style="border-bottom:1px solid #e9eaeb; margin-top:10px; margin-bottom:10px;" align="right"><span class="addedittitles" style="margin-top:10px;">Description</span></td>
<td style="border-bottom:1px solid #e9eaeb; "><span class="faq_colomn_right">
<textarea name="mfgDesc" id="mfgDesc" class="validate[required]" cols="35" style="width:572px; order:1px solid #cdcdcf; height: 200px;"> </textarea>
</span></td>
</tr>
<tr>
<td style="border-bottom:1px solid #e9eaeb; margin-top:10px; margin-bottom:10px;" align="right"><span class="addedittitles">Website Url</span></td>
<td style="border-bottom:1px solid #e9eaeb; "><span class="faq_colomn_right">
<input class="validate[required,maxSize[250]]" name="mfgWebsiteURL" id="mfgWebsiteURL" type="text" value="" maxlength="250" style="width:85%; border:1px solid #cdcdcf; height:22px;"/>
</span></td>
</tr>
<tr>
<td style="border-bottom:1px solid #e9eaeb; margin-top:10px; margin-bottom:10px;" align="right"><span class="addedittitles">Contact Name</span></td>
<td style="border-bottom:1px solid #e9eaeb; "><span class="faq_colomn_right">
<input class="validate[required,maxSize[250]]" name="mfgContactName" id="mfgContactName" type="text" value="" maxlength="250" style="width:85%; border:1px solid #cdcdcf; height:22px;"/>
</span></td>
</tr>
<tr>
<td style="border-bottom:1px solid #e9eaeb; margin-top:10px; margin-bottom:10px;" align="right"><span class="addedittitles">Phone No</span></td>
<td style="border-bottom:1px solid #e9eaeb; "><span class="faq_colomn_right">
<input class="validate[required,maxSize[250],custom[phone]]" name="mfgContactPhone" id="mfgContactPhone" type="text" value="" maxlength="100" style="width:85%; border:1px solid #cdcdcf; height:22px;"/>
</span></td>
</tr>
<tr>
<td style="border-bottom:1px solid #e9eaeb; margin-top:10px; margin-bottom:10px;" align="right"><div class="addedittitles">Email</div></td>
<td style="border-bottom:1px solid #e9eaeb; "><span class="faq_colomn_right">
<input class="validate[required,maxSize[250],custom[email]]" name="mfgContactEmail" id="mfgContactEmail" type="text" value="" maxlength="250" style="width:85%; border:1px solid #cdcdcf; height:22px;"/>
</span></td>
</tr>
<tr align="right">
<td height="40px;" align="right" colspan="4"><input name="save" type="submit" id="save" value="Save" class="button1" />
<input name="id" type="hidden" id="id" value="new">
</td>
</tr> </table>
</td>
</form>

There is a great validation plugin, called jquery validation, see here.
Remember, you should include jQuery BEFORE inclusion of other plugins.

Related

Border and values not matching in PDF

This happens when I use display: inline-block to wrap a table. The table itself is in the correct position (shown as pink), but the border is shifted down.
Here is the code I used. The three table has the same code, so I removed the other two. And I removed the codes used to setup dompdf
<div style="display: inline-block;">
<table class="table-bordered" style="background-color: pink;">
<tbody>
<tr>
<th colspan="2" class="text-left p-2">
<p class="mb-0">
Some Name
</p>
<p class="mb-0">
Some Date
</p>
</th>
</tr>
<tr>
<td class="text-left p-1">
DATA
</td>
<td class="p-1">
VALUE
</td>
</tr>
<tr>
<td class="text-left p-1">
DATA
</td>
<td class="p-1">
VALUE
</td>
</tr>
</tbody>
</table>
</div>
When I use display: inline-table instead, this happens:
The table is alright, but it is not in line anymore.
And this is when I used float:left:
In line, but the border seems to moved to the leftmost side as well
I'm doing this because I can't use the grid system of Bootstrap 4 (uses flex), and I need small divs that are inline.
Any idea on possible solutions for this problem or the cause? I want it to be in line and borders properly placed. All of these are showing me the expected result when viewed in the browser, but not in the PDF.
Hope this helps!
You can add three table's inside each td of another table.
<table style="table-layout:fixed;margin:0 auto;">
<tbody>
<tr>
<td style="vertical-align:top;">
<div style="display: inline-block;">
<table class="table-bordered" style="background-color: pink;table-layout: fixed;border-collapse: collapse;">
<tbody>
<tr>
<th colspan="2" class="text-left p-2" style="border: 1px solid #000;">
<p class="mb-0">
Some Name
</p>
<p class="mb-0">
Some Date
</p>
</th>
</tr>
<tr>
<td class="text-left p-1" style="border: 1px solid #000;">
DATA
</td>
<td class="p-1" style="border: 1px solid #000;">
VALUE
</td>
</tr>
<tr>
<td class="text-left p-1" style="border: 1px solid #000;">
DATA
</td>
<td class="p-1" style="border: 1px solid #000;">
VALUE
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td style="vertical-align:top;">
<div style="display: inline-block;">
<table class="table-bordered" style="background-color: pink;table-layout: fixed;border-collapse: collapse;">
<tbody>
<tr>
<th colspan="2" class="text-left p-2" style="border: 1px solid #000;">
<p class="mb-0">
Some Name
</p>
<p class="mb-0">
Some Date
</p>
</th>
</tr>
<tr>
<td class="text-left p-1" style="border: 1px solid #000;">
DATA
</td>
<td class="p-1" style="border: 1px solid #000;">
VALUE
</td>
</tr>
<tr>
<td class="text-left p-1" style="border: 1px solid #000;">
DATA
</td>
<td class="p-1" style="border: 1px solid #000;">
VALUE
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td style="vertical-align:top;">
<div style="display: inline-block;">
<table class="table-bordered" style="background-color: pink;table-layout: fixed;border-collapse: collapse;">
<tbody>
<tr>
<th colspan="2" class="text-left p-2" style="border: 1px solid #000;">
<p class="mb-0">
Some Name
</p>
<p class="mb-0">
Some Date
</p>
</th>
</tr>
<tr>
<td class="text-left p-1" style="border: 1px solid #000;">
DATA
</td>
<td class="p-1" style="border: 1px solid #000;">
VALUE
</td>
</tr>
<tr>
<td class="text-left p-1" style="border: 1px solid #000;">
DATA
</td>
<td class="p-1" style="border: 1px solid #000;">
VALUE
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>

How to include JavaScript / jQuery inside HTML while sending a form to mail using mail function of PHP

I want to send my form to mail with a validation. It is working but my validation does not work.
Here is my code:
$send_email = "ajinkyasmore#gmail.com";
$subject = "Testing Mail.!";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$message = "<html><head>
<link rel='stylesheet' type='text/css' href='welfare.mswarehousing.com/stylesheets/jquery.validate.css' />
<link rel='stylesheet' type='text/css' href='welfare.mswarehousing.com/stylesheets/style.css' />
<script src='welfare.mswarehousing.com/js/jquery-1.3.2.js' type='text/javascript'>
</script>
<script src='welfare.mswarehousing.com/js/jquery.validate.js' type='text/javascript'>
</script>
<script type='text/javascript'>
jQuery(function(){
alert('inside js function');
jQuery('#fname').validate({
expression: 'if (VAL == '') return false; else return true;',
message: 'field is null'
});
});
</script>
</head>
<form name='frame' id='main_frame' action='http://welfare.mswarehousing.com/thankyou.php' method='get' enctype='multipart/form-data'>
<table width='250' cellspacing='0' cellpadding='0' border='0' align='left'>
<tbody>
<tr>
<td>
<table width='250' cellspacing='0' cellpadding='0' border='0' bgcolor='#c7ac77'>
<tbody>
<tr>
<td width='15' height='15'> </td>
<td> </td>
<td width='15'> </td>
</tr>
<tr>
<td> </td>
<td>
<table width='220' cellspacing='0' cellpadding='0' border='0' align='center'>
<tbody>
<tr>
<td style='font-family: Calibri,Verdana; font-size: 25px; color: #ffffff; line-height: 26px;'><strong>Show Your Interest</strong></td>
</tr>
<tr>
<td height='15'> </td>
</tr>
<tr>
<td style='font-family: Arial,Verdana; font-size: 12px; color: #ffffff; line-height: 18px;'>Name</td>
</tr>
<tr>
<td bgcolor='#ededed' height='28' style='font-family: Arial,Verdana; font-size: 12px; color: #666666; border: 1px solid #ffffff; background: #ffffff; padding-left: 5px;'>
<input type='text' name='fname' size='26' id='fname' required/>
<input type='hidden' name='send_date' value='2015/08/08'>
<input type='hidden' name='property_name' value='Drushtitechnet'>
<input type='hidden' name='send_mail' value='$send_email'>
</td>
</tr>
<tr>
<td height='10'> </td>
</tr>
<tr>
<td style='font-family: Arial,Verdana; font-size: 12px; color: #ffffff; line-height: 18px;'>Phone</td>
</tr>
<tr>
<td height='28' style='font-family: Arial,Verdana; font-size: 12px; color: #666666; border: 1px solid #ffffff; background: #ffffff; padding-left: 5px;'><input type='text' name='contact' size='26' required/></td>
</tr>
<tr>
<td height='10'> </td>
</tr>
<tr>
<td style='font-family: Arial,Verdana; font-size: 12px; color: #ffffff; line-height: 18px;'>Email</td>
</tr>
<tr>
<td height='28' style='font-family: Arial,Verdana; font-size: 12px; border: 1px solid #ffffff; background: #ffffff; padding-left: 5px;'><input type='email' name='from' size='26' required></td>
</tr>
<tr>
<td height='15'> </td>
</tr>
<tr>
<td valign='top'>
<table width='220' cellspacing='0' cellpadding='0' border='0'>
<tbody>
<tr>
<td height='40' style='font-family: Arial; font-size: 21px; text-align: center; background: #d24836; border: 1px solid #d24836; border-radius: 3px;'><a target='_blank' style='text-decoration: none; color: #ffffff; line-height: 40px; display: block;'><input type='submit' id='submit' value='I am Interested'></a></td>
</tr>
<tr>
<td height='10'> </td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
<td> </td>
</tr>
<tr>
<td height='20'> </td>
<td> </td>
<td> </td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td height='20'> </td>
</tr>
</tbody>
</table>
</form></html>";
mail($send_email, $subject, $message, $headers);
?>
Almost all emails clients will not accept Javascript by default and with very good (security) reasons.
Lead your reader to a website with the form.

Html2PDF HTML code issue

Well I have been at this for hours now. I'm using HTML2PDF to generate an invoice. My program creates a temporary invoice without issue. The issue I'm having is once the program tries to create a PDF from the temp file I'm getting an error:
ERROR n°5
File : /home/x/public_html/office/cron/invoices/php-pdf/_class/parsingHtml.class.php
Line : 218
HTML code invalid, all tags must be closed.
Status :
Array
(
[0] => page
[1] => table
[2] => tr
[3] => td
[4] => table
[5] => tr
[6] => td
)
I understand its saying all the HTML tags have not been closed. I've validated my code many different times, many different ways and sites and all are returning valid. I had some style issues that have been fixed but I still have no luck. My html is as follows:
<!doctype html>
<html>
<head>
<title>Untitled Document</title>
<style>
<!--
body {font-family:Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;}
.center {text-align:center;}
.ltgray {color:#C5C5C5;}
.invoice {vertical-align:text-top;}
.gbk td {background-color:#EDEBEB; border:none; font-size:13px; padding-bottom:8px; padding-top:8px; padding-left:10px}
.btboader { border-bottom:thin dotted; border-color:#E4E2E2; padding-bottom:8px; padding-top:8px; padding-left:10px }
.ltgrayt {color:#969696;}
.center {align-content:center; font-size:12px; font-weight:bold;}
.db {border:thin dotted; background-color:#EDEBEB;}
.padded {padding-left:15px;}
.hr { border: 0; height: 1px; background-image: -webkit-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); background-image: -moz-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); background-image: -ms-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); background-image: -o-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0)); }
-->
</style>
</head>
<body>
<table style="width: 100%">
<tr>
<td class="invoice"><h2 class="ltgray">Invoice</h2> </td>
<td style="float: right">
<table>
<tr>
<td>Date:</td> <td> 03/12/2015</td>
</tr>
<tr>
<td>Invoice #:</td> <td> 100367</td>
</tr>
<tr>
<td> Propery </td> <td> N/a </td>
</tr>
</table>
</td>
</tr>
</table>
<p></p>
<table style="width: 95%; margin: 0 auto;">
<tr>
<td style="width: 50%"><span class="ltgray">Company Information</span><br />
<strong>XXX</strong><br />XXXX<br />XXXX</td>
<td style="width: 50%"><span class="ltgray">Customer Information</span><br />
<strong>XXXX</strong><br />XXXX<br />
XXXX<br />XXXX<br />Phone: XXXX<br />Email: XXXX</td>
</tr>
</table>
<br /><p></p>
<table style="width: 100%" class="tbl">
<tr class="gbk">
<td style="width: 60%"><strong>Item</strong></td>
<td style="width: 15%"><strong>Price</strong></td>
<td style="width: 10%"><strong>Qty</strong></td>
<td style="width: 15%; margin: 0 auto;"> <strong>Total</strong> </td>
</tr>
<tr>
<td style="width: 60%" class="btboader">Mulch - Red</td>
<td style="width: 15%" class="btboader">$2.50</td>
<td style="width: 10%" class="btboader">153</td>
<td style="width: 15%; margin: 0 auto;" class="btboader">$382.50</td>
</tr>
<tr>
<td style="width: 60%" class="btboader">Mulch - Black</td>
<td style="width: 15%" class="btboader">$3.50</td>
<td style="width: 10%" class="btboader">1</td>
<td style="width: 15%; margin: 0 auto;" class="btboader">$3.50</td>
</tr>
<tr>
<td style="width: 60%" class="btboader">Mulch - Brown<br><small>Bagged mulch, price includes delivery - Total 2 1/2 pallets</small> </td>
<td style="width: 15%" class="btboader">$3.50</td>
<td style="width: 10%" class="btboader">160</td>
<td style="width: 15%; margin: 0 auto;" class="btboader">$560.00</td>
</tr>
<tr>
<td colspan="2">
<table style="width: 100%">
<tr>
<td style="width: 20%">Payment Terms:</td>
<td style="width: 80%">Due On Receipt</td>
</tr>
<tr>
<td style="width: 50%">Discount(%):</td>
<td style="width: 50%">10.0</td>
</tr>
<tr>
<td style="width: 50%">Past Due Amount:</td>
<td style="width: 50%">$0.00</td>
</tr>
</table>
</td>
<td colspan="2">
<table style="width: 100%">
<tr>
<td style="width: 50%" class="ltgrayt">Subtotal:</td>
<td style="width: 50%; float: right;">$946.00</td>
</tr>
<tr>
<td style="width: 50%" class="ltgrayt">Tax (6.5%):</td>
<td style="width: 50%; float: right;"> $0.00</td>
</tr>
<tr>
<td style="width: 50%" class="ltgrayt">Discount:</td>
<td style="width: 50%; float: right;"> $94.60</td>
</tr>
<tr>
<td style="width: 50%" class="ltgrayt">Past Due:</td>
<td style="width: 50%; float: right;"><strong> $0.00 </strong></td>
</tr>
<tr>
<td style="width: 50%" class="ltgrayt">Total:</td>
<td style="width: 50%; float: right;"><strong> $851.40 </strong></td>
</tr>
</table>
</td>
</tr>
</table>
<br /><br />
<table class="db" style="width: 80%; margin: 0 auto;">
<tr>
<td><strong class="padded"><small>Order Notes:</small></strong><br /><p class="padded">Thank you for your business!</p>
</td>
</tr>
</table>
<hr class="hr">
<p class="center">XXXX, XXXX, XXXX - Phone: XXXX - Direct Cell: XXXX Email:XXXX<br />
Please make checks payable to: XXXX</p>
</body>
</html>
What am I missing that's causing this error? The only other thing I could think of is that HTML2PDF doesn't support something in my styling. I use HTML2PDF for another project without issue so Im not sure where I made a wrong turn.

PHP, generate PDF file from HTML

I'm a novice when it comes to generating pdf files
I've tried tcpdf and mpdf but not getting the format the way i want it be.
Here's my mpdf code
include('./mpdf.php');
$mpdf=new mPDF();
$html = '<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="cssForTable.css">
</head>
<body>
<table>
<thead>
<tr>
<th width="25%">Client Details</th>
<th colspan="2" width="50%"><h2 style="padding-top: 0; margin-bottom: 0; margin-top: 0;text-align: center"><strong>ROAD TRAFFIC ACCIDENT</strong></h2></th>
<th width="25%">Legal HQ</th>
</tr>
</thead>
<tbody>
<tr>
<td width="50%" colspan="2">
<strong>Instructed Another Solicito?</strong>
Yes <input type="checkbox" /> No <input type="checkbox" />
</td>
<th width="50%" colspan="2" rowspan="3">
Claiming For:<br />
Personal Injury Yes <input type="checkbox" style="margin-bottom: 7px;" />
No <input type="checkbox" style="margin-bottom: 7px;" /><br />
Vehicle Damage Yes <input type="checkbox" style="margin-bottom: 7px;" />
No <input type="checkbox" style="margin-bottom: 7px;" /><br />
Loss of Earnings Yes <input type="checkbox" />
No <input type="checkbox" />
</th>
</tr>
<tr><th colspan="2"><h3 style="padding-top: 0; margin-bottom: 0; margin-top: 0;">ACCIDENT DETAILS</h3></th></tr>
<tr>
<th width="25%">Date of Accident</th>
<td width="25%"> </td>
</tr>
<tr>
<th width="25%">Time of Accident</th>
<td width="25%"> </td>
<th width="25%">No of Occupants (inc driver)</th>
<td width="25%"> </td>
</tr>
<tr>
<th width="25%">Location of Accident</th>
<td width="25%"> </td>
<td width="50%" colspan="2" rowspan="2" valign="top" >
<strong>Were Police Involved?
Yes <input type="checkbox" />
No <input type="checkbox" />
<br />
<br />If so, Police No/Station: </strong>
</td>
</tr>
<tr>
<td width="25%" colspan="2" rowspan="2" valign="top"><strong>Accident Circumstances</strong><br /><br /></td>
</tr>
<tr>
<th width="25%" colspan="2">
Is Client:<br />
Owner <input type="checkbox" style="margin-left: 15em; margin-bottom: 7px;" /><br />
Driver <input type="checkbox" style="margin-left: 15em; margin-bottom: 7px;" /><br />
Passenger <input type="checkbox" style="margin-left: 13em;" />
</th>
</tr>
<tr>
<th width="25%">Weather Conditions</th>
<th width="75%" colspan="3">
<label style="margin-left: 2em; margin-bottom: 7px;" > Sunny <input type="checkbox" /></label>
<label style="margin-left: 8em; margin-bottom: 7px;" > Rain <input type="checkbox" /></label>
<label style="margin-left: 8em; margin-bottom: 7px;" > Snow <input type="checkbox" /></label><br />
<label style="margin-left: 2em; margin-bottom: 7px;" > Ice <input type="checkbox" /></label>
<label style="margin-left: 8em; margin-bottom: 7px;" > Fog <input type="checkbox" /></label>
<label style="margin-left: 8em; margin-bottom: 7px;" > Dark <input type="checkbox" /></label>
</th>
</tr>
</tbody>
</table>
</body>
</html>';
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
The above code generates the following PDF file (screen shot)
Where as it should look like the following
My question is, is there a way to generate PDF as we generate HTML I mean is there a way to print whatever html+PHP has generated on client side?
Any Idea?
HTML2PDF converters may be overstrained with that layout. You may should consider PDF-Generators with more powerful layout-options.
The downside is, that you have to define your layout in another layout-language, but this will guarantee a satisfying output.
Have you considered to use XSL/FO with a suitable generator like PDFnow?
Yes, you can do this. Here is the complete code.
It works perfectly.
You can get value from another page using post method also. Your choice.
<?php $student_id = $_GET['student_id']; ?>
<?php
include("mpdf/mpdf.php");
$html .= "
<html>
<head>
<style>
body {font-family: sans-serif;
font-size: 10pt;
background-image: url(\"images/ok.jpg\");
background-repeat: no-repeat;
padding-top:10pt;
margin-top: 100px;
padding-top: 50px;
}
td { vertical-align: top;
border-left: 0.6mm solid #000000;
border-right: 0.6mm solid #000000;
align: center;
}
p.student_id{
padding-left : 140px;
padding-top : -27px;
}
</style>
</head>
<body>
<!--mpdf
<p class=\"student_id\">$student_id</p>
<sethtmlpageheader name='myheader' value='on' show-this-page='1' />
<sethtmlpagefooter name='myfooter' value='on' />
mpdf-->
</body>
</html>
";
$mpdf=new mPDF();
$mpdf->WriteHTML($html);
$mpdf->SetDisplayMode('fullpage');
$mpdf->Output();
?>

XPATH not working on the HTML

I have a code that reads an HTML file from my local web server localhost and then converts it to XHTML with tidy. Then i load that XHTML into my DOM. the code looks like this
<?php
function getXHTML($html)
{
$options = array("output-html" => true,"quote-nbsp" => true, "drop-proprietary-attributes" => true,"drop-font-tags" => true,"drop-empty-paras" => true,"hide-comments" => true);
$tidy=new tidy();
$xhtml=$tidy->repairString($html,$options);
echo $xhtml;
return $xhtml;
}
$content = file_get_contents("http://localhost/filename.htm");
$page = new DOMDocument();
$xpath=new DOMXPath($page);
$content = getXHTML($content); // this is a tidy function to return XHTML
$page->loadHTML($content);
$totalPath = "//body/table[3]/tbody/tr[1]/td[4]";
$total = $xpath->query($totalPath);
echo $total->length; // this shows zero
?>
the contents of filename.htm looks like this
<!-- saved from url=(0041)http://www.rtu.ac.in/results/reformat.php -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="SHORTCUT ICON" href="http://www.rtu.ac.in/favicon.ico">
<link href="./Result - Rajasthan Technical University6_files/styleresults.css" rel="stylesheet" type="text/css">
<title>Result - Rajasthan Technical University</title>
</head>
<body>
<table width="773" cellpadding="5" cellspacing="0" align="center">
<tbody><tr height="60">
<td width="16%" height="60" valign="top"><font color="brown" size="+2"><img src="./Result - Rajasthan Technical University6_files/logo.jpg" width="100" height="102" border="0" align="right"> </font></td>
<td width="72%" height="60" align="center" valign="top"><p><font color="brown" size="+2"><strong>RAJASTHAN TECHNICAL UNIVERSITY </strong></font></p><font color="brown" size="+2">
<p><font size="+1"><strong>B.Tech -IVth SEMESTER -2010(Main) 16.5.2011</strong></font></p><font size="+1"> </font></font></td>
<td width="12%" height="80"><strong>www.rtu.ac.in</strong> </td>
</tr>
</tbody></table>
<br>
<br>
<table width="783" align="center" cellpadding="5" cellspacing="0" class="table">
<tbody>
<tr>
<td width="34%" align="center" valign="top" rowspan="2"><strong>Subject(s) Name </strong> </td>
<td width="10%" align="center" valign="top" colspan="1" rowspan="2"> <strong>Subject(s) Code </strong> </td>
<td align="center" valign="top" colspan="3" rowspan="1"><strong>Marks Obtained </strong> </td>
</tr>
<tr>
<td width="20%" align="center"><strong>Internal</strong> </td>
<td width="18%" align="center"><strong>Theory</strong> </td>
<td width="18%" align="center"> </td>
</tr>
<tr>
<td width="34%" align="center" style=" border-bottom: 0px none transparent;"><strong>SUBJECT-1</strong> </td>
<td width="10%" align="center" style=" border-bottom: 0px none transparent;">4551</td>
<td width="20%" align="center" style=" border-bottom: 0px none transparent;"> 16</td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"> 50</td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"> </td>
</tr>
<tr>
<td width="34%" align="center" style=" border-bottom: 0px none transparent;"><strong>SUBJECT-2</strong> </td>
<td width="10%" align="center" style=" border-bottom: 0px none transparent;"> 4552</td>
<td width="20%" align="center" style=" border-bottom: 0px none transparent;"> 17</td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"> 61</td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"> </td>
</tr>
<tr>
<td width="34%" align="center" style=" border-bottom: 0px none transparent;"><strong>SUBJECT-3</strong> </td>
<td width="10%" align="center" style=" border-bottom: 0px none transparent;">4553</td>
<td width="20%" align="center" style=" border-bottom: 0px none transparent;"> 19</td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"> 49</td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"> </td>
</tr>
<tr>
<td align="center" style=" border-bottom: 0px none transparent;"><strong>SUBJECT-4</strong> </td>
<td align="center" style=" border-bottom: 0px none transparent;">4554</td>
<td align="center" style=" border-bottom: 0px none transparent;"> 14</td>
<td align="center" style=" border-bottom: 0px none transparent;"> 68</td>
<td align="center" style=" border-bottom: 0px none transparent;"> </td>
</tr>
<tr>
<td align="center" style=" border-bottom: 0px none transparent;"><strong>SUBJECT-5</strong> </td>
<td align="center" style=" border-bottom: 0px none transparent;">4555</td>
<td align="center" style=" border-bottom: 0px none transparent;"> 14</td>
<td align="center" style=" border-bottom: 0px none transparent;"> 36</td>
<td align="center" style=" border-bottom: 0px none transparent;"> </td>
</tr>
<tr>
<td width="34%" align="center" style=" border-bottom: 0px none transparent;"><strong>SUBJECT-6</strong> </td>
<td width="10%" align="center" style=" border-bottom: 0px none transparent;">4556</td>
<td width="20%" align="center" style=" border-bottom: 0px none transparent;"> 19</td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"> 48</td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"> </td>
</tr><tr>
<td align="center" style=" border-bottom: 0px none transparent;"> </td>
<td align="center" style=" border-bottom: 0px none transparent;"> </td>
<td align="center" style=" border-bottom: 0px none transparent;"> </td>
<td align="center" style=" border-bottom: 0px none transparent;"> <strong>Internal</strong> </td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"><strong>Practical</strong> </td>
</tr>
<tr>
<td width="34%" align="center" style=" border-bottom: 0px none transparent;"><strong>PSUBJECT-1</strong> </td>
<td width="10%" align="center" style=" border-bottom: 0px none transparent;">4174</td>
<td width="20%" align="center" style=" border-bottom: 0px none transparent;"> </td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"> 29</td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;">48</td>
</tr>
<tr>
<td width="34%" align="center" style=" border-bottom: 0px none transparent;"><strong>PSUBJECT-2</strong> </td>
<td width="10%" align="center" style=" border-bottom: 0px none transparent;">4175</td>
<td width="20%" align="center" style=" border-bottom: 0px none transparent;"> </td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"> 16</td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;">26</td>
</tr>
<tr>
<td width="34%" align="center" style=" border-bottom: 0px none transparent;"><strong>PSUBJECT-3</strong> </td>
<td width="10%" align="center" style=" border-bottom: 0px none transparent;">4171</td>
<td width="20%" align="center" style=" border-bottom: 0px none transparent;"> </td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"> 15</td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;">27</td>
</tr>
<tr>
<td align="center" style=" border-bottom: 0px none transparent;"><strong>PSUBJECT-4</strong> </td>
<td align="center" style=" border-bottom: 0px none transparent;">4172</td>
<td align="center" style=" border-bottom: 0px none transparent;"> </td>
<td align="center" style=" border-bottom: 0px none transparent;"> 17</td>
<td align="center" style=" border-bottom: 0px none transparent;">29</td>
</tr>
<tr>
<td align="center" style=" border-bottom: 0px none transparent;"><strong>PSUBJECT-5</strong> </td>
<td align="center" style=" border-bottom: 0px none transparent;">4173</td>
<td align="center" style=" border-bottom: 0px none transparent;"> </td>
<td align="center" style=" border-bottom: 0px none transparent;"> 29</td>
<td align="center" style=" border-bottom: 0px none transparent;">46</td>
</tr>
<tr>
<td width="34%" align="center" style=" border-bottom: 0px none transparent;"><strong>Disipline (Deca)</strong> </td>
<td width="10%" align="center" style=" border-bottom: 0px none transparent;">4176</td>
<td width="20%" align="center" style=" border-bottom: 0px none transparent;"> </td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;"> </td>
<td width="18%" align="center" style=" border-bottom: 0px none transparent;">46</td>
</tr>
<tr><td> </td><td> </td><td> </td><td> </td><td> </td></tr></tbody>
</table>
<br><table width="783" align="center" cellpadding="5" cellspacing="0" class="table">
<tbody><tr>
<td width="18%" align="center" valign="top"><strong>Practical Marks </strong> </td>
<td width="18%" align="center" valign="top">328</td>
<td width="19%" align="center" valign="top"><strong>Theory Marks </strong> </td>
<td width="19%" align="center" valign="top">411</td>
</tr>
<tr>
<td width="18%" align="center"><strong>Institute Code </strong> </td>
<td width="18%" align="center"> 1229 </td>
<td width="19%" align="center"><strong>DECCA </strong> </td>
<td width="19%" align="center">4176</td>
</tr>
<tr>
<td width="18%" align="center"><strong>Division </strong> </td>
<td width="18%" align="center"> PASS </td>
<td width="19%" align="center"><strong>Grand Total </strong> </td>
<td width="19%" align="center">739</td>
</tr>
</tbody></table>
<!-- Reformatter by Shashank Kumar Jain (CS, IIIrd Year, 2010-11) -->
<div id="csscan-wrapper" style="display: none; "><h2 id="csscan-header">element</h2><table id="csscan-table"><tbody><tr><th colspan="2" id="csscan-header-font" class="csscan-header">Font</th></tr><tr id="csscan-row-font-family"><td id="csscan-property-font-family" class="csscan-property">font-family</td><td id="csscan-value-font-family" class="csscan-value"></td></tr><tr id="csscan-row-font-size"><td id="csscan-property-font-size" class="csscan-property">font-size</td><td id="csscan-value-font-size" class="csscan-value"></td></tr><tr id="csscan-row-font-style"><td id="csscan-property-font-style" class="csscan-property">font-style</td><td id="csscan-value-font-style" class="csscan-value"></td></tr><tr id="csscan-row-font-variant"><td id="csscan-property-font-variant" class="csscan-property">font-variant</td><td id="csscan-value-font-variant" class="csscan-value"></td></tr><tr id="csscan-row-font-weight"><td id="csscan-property-font-weight" class="csscan-property">font-weight</td><td id="csscan-value-font-weight" class="csscan-value"></td></tr><tr id="csscan-row-letter-spacing"><td id="csscan-property-letter-spacing" class="csscan-property">letter-spacing</td><td id="csscan-value-letter-spacing" class="csscan-value"></td></tr><tr id="csscan-row-line-height"><td id="csscan-property-line-height" class="csscan-property">line-height</td><td id="csscan-value-line-height" class="csscan-value"></td></tr><tr id="csscan-row-text-decoration"><td id="csscan-property-text-decoration" class="csscan-property">text-decoration</td><td id="csscan-value-text-decoration" class="csscan-value"></td></tr><tr id="csscan-row-text-align"><td id="csscan-property-text-align" class="csscan-property">text-align</td><td id="csscan-value-text-align" class="csscan-value"></td></tr><tr id="csscan-row-text-indent"><td id="csscan-property-text-indent" class="csscan-property">text-indent</td><td id="csscan-value-text-indent" class="csscan-value"></td></tr><tr id="csscan-row-text-transform"><td id="csscan-property-text-transform" class="csscan-property">text-transform</td><td id="csscan-value-text-transform" class="csscan-value"></td></tr><tr id="csscan-row-white-space"><td id="csscan-property-white-space" class="csscan-property">white-space</td><td id="csscan-value-white-space" class="csscan-value"></td></tr><tr id="csscan-row-word-spacing"><td id="csscan-property-word-spacing" class="csscan-property">word-spacing</td><td id="csscan-value-word-spacing" class="csscan-value"></td></tr><tr id="csscan-row-color"><td id="csscan-property-color" class="csscan-property">color</td><td id="csscan-value-color" class="csscan-value"></td></tr><tr><th colspan="2" id="csscan-header-background" class="csscan-header">Background</th></tr><tr id="csscan-row-background-attachment"><td id="csscan-property-background-attachment" class="csscan-property">bg-attachment</td><td id="csscan-value-background-attachment" class="csscan-value"></td></tr><tr id="csscan-row-background-color"><td id="csscan-property-background-color" class="csscan-property">bg-color</td><td id="csscan-value-background-color" class="csscan-value"></td></tr><tr id="csscan-row-background-image"><td id="csscan-property-background-image" class="csscan-property">bg-image</td><td id="csscan-value-background-image" class="csscan-value"></td></tr><tr id="csscan-row-background-position"><td id="csscan-property-background-position" class="csscan-property">bg-position</td><td id="csscan-value-background-position" class="csscan-value"></td></tr><tr id="csscan-row-background-repeat"><td id="csscan-property-background-repeat" class="csscan-property">bg-repeat</td><td id="csscan-value-background-repeat" class="csscan-value"></td></tr><tr><th colspan="2" id="csscan-header-size" class="csscan-header">Box</th></tr><tr id="csscan-row-width"><td id="csscan-property-width" class="csscan-property">width</td><td id="csscan-value-width" class="csscan-value"></td></tr><tr id="csscan-row-height"><td id="csscan-property-height" class="csscan-property">height</td><td id="csscan-value-height" class="csscan-value"></td></tr><tr id="csscan-row-border-top"><td id="csscan-property-border-top" class="csscan-property">border-top</td><td id="csscan-value-border-top" class="csscan-value"></td></tr><tr id="csscan-row-border-right"><td id="csscan-property-border-right" class="csscan-property">border-right</td><td id="csscan-value-border-right" class="csscan-value"></td></tr><tr id="csscan-row-border-bottom"><td id="csscan-property-border-bottom" class="csscan-property">border-bottom</td><td id="csscan-value-border-bottom" class="csscan-value"></td></tr><tr id="csscan-row-border-left"><td id="csscan-property-border-left" class="csscan-property">border-left</td><td id="csscan-value-border-left" class="csscan-value"></td></tr><tr id="csscan-row-margin"><td id="csscan-property-margin" class="csscan-property">margin</td><td id="csscan-value-margin" class="csscan-value"></td></tr><tr id="csscan-row-padding"><td id="csscan-property-padding" class="csscan-property">padding</td><td id="csscan-value-padding" class="csscan-value"></td></tr><tr id="csscan-row-max-height"><td id="csscan-property-max-height" class="csscan-property">max-height</td><td id="csscan-value-max-height" class="csscan-value"></td></tr><tr id="csscan-row-min-height"><td id="csscan-property-min-height" class="csscan-property">min-height</td><td id="csscan-value-min-height" class="csscan-value"></td></tr><tr id="csscan-row-max-width"><td id="csscan-property-max-width" class="csscan-property">max-width</td><td id="csscan-value-max-width" class="csscan-value"></td></tr><tr id="csscan-row-min-width"><td id="csscan-property-min-width" class="csscan-property">min-width</td><td id="csscan-value-min-width" class="csscan-value"></td></tr><tr id="csscan-row-outline-color"><td id="csscan-property-outline-color" class="csscan-property">outline-color</td><td id="csscan-value-outline-color" class="csscan-value"></td></tr><tr id="csscan-row-outline-style"><td id="csscan-property-outline-style" class="csscan-property">outline-style</td><td id="csscan-value-outline-style" class="csscan-value"></td></tr><tr id="csscan-row-outline-width"><td id="csscan-property-outline-width" class="csscan-property">outline-width</td><td id="csscan-value-outline-width" class="csscan-value"></td></tr><tr><th colspan="2" id="csscan-header-position" class="csscan-header">Positioning</th></tr><tr id="csscan-row-position"><td id="csscan-property-position" class="csscan-property">position</td><td id="csscan-value-position" class="csscan-value"></td></tr><tr id="csscan-row-top"><td id="csscan-property-top" class="csscan-property">top</td><td id="csscan-value-top" class="csscan-value"></td></tr><tr id="csscan-row-bottom"><td id="csscan-property-bottom" class="csscan-property">bottom</td><td id="csscan-value-bottom" class="csscan-value"></td></tr><tr id="csscan-row-right"><td id="csscan-property-right" class="csscan-property">right</td><td id="csscan-value-right" class="csscan-value"></td></tr><tr id="csscan-row-left"><td id="csscan-property-left" class="csscan-property">left</td><td id="csscan-value-left" class="csscan-value"></td></tr><tr id="csscan-row-float"><td id="csscan-property-float" class="csscan-property">float</td><td id="csscan-value-float" class="csscan-value"></td></tr><tr id="csscan-row-display"><td id="csscan-property-display" class="csscan-property">display</td><td id="csscan-value-display" class="csscan-value"></td></tr><tr id="csscan-row-clear"><td id="csscan-property-clear" class="csscan-property">clear</td><td id="csscan-value-clear" class="csscan-value"></td></tr><tr id="csscan-row-z-index"><td id="csscan-property-z-index" class="csscan-property">z-index</td><td id="csscan-value-z-index" class="csscan-value"></td></tr><tr><th colspan="2" id="csscan-header-list" class="csscan-header">List</th></tr><tr id="csscan-row-list-style-image"><td id="csscan-property-list-style-image" class="csscan-property">list-style-image</td><td id="csscan-value-list-style-image" class="csscan-value"></td></tr><tr id="csscan-row-list-style-type"><td id="csscan-property-list-style-type" class="csscan-property">list-style-type</td><td id="csscan-value-list-style-type" class="csscan-value"></td></tr><tr id="csscan-row-list-style-position"><td id="csscan-property-list-style-position" class="csscan-property">list-style-position</td><td id="csscan-value-list-style-position" class="csscan-value"></td></tr><tr><th colspan="2" id="csscan-header-table" class="csscan-header">Table</th></tr><tr id="csscan-row-vertical-align"><td id="csscan-property-vertical-align" class="csscan-property">vertical-align</td><td id="csscan-value-vertical-align" class="csscan-value"></td></tr><tr id="csscan-row-border-collapse"><td id="csscan-property-border-collapse" class="csscan-property">border-collapse</td><td id="csscan-value-border-collapse" class="csscan-value"></td></tr><tr id="csscan-row-border-spacing"><td id="csscan-property-border-spacing" class="csscan-property">border-spacing</td><td id="csscan-value-border-spacing" class="csscan-value"></td></tr><tr id="csscan-row-caption-side"><td id="csscan-property-caption-side" class="csscan-property">caption-side</td><td id="csscan-value-caption-side" class="csscan-value"></td></tr><tr id="csscan-row-empty-cells"><td id="csscan-property-empty-cells" class="csscan-property">empty-cells</td><td id="csscan-value-empty-cells" class="csscan-value"></td></tr><tr id="csscan-row-table-layout"><td id="csscan-property-table-layout" class="csscan-property">table-layout</td><td id="csscan-value-table-layout" class="csscan-value"></td></tr><tr><th colspan="2" id="csscan-header-effects" class="csscan-header">Effects</th></tr><tr id="csscan-row-text-shadow"><td id="csscan-property-text-shadow" class="csscan-property">text-shadow</td><td id="csscan-value-text-shadow" class="csscan-value"></td></tr><tr id="csscan-row--webkit-box-shadow"><td id="csscan-property--webkit-box-shadow" class="csscan-property">-webkit-box-shadow</td><td id="csscan-value--webkit-box-shadow" class="csscan-value"></td></tr><tr id="csscan-row-border-radius"><td id="csscan-property-border-radius" class="csscan-property">border-radius</td><td id="csscan-value-border-radius" class="csscan-value"></td></tr><tr><th colspan="2" id="csscan-header-other" class="csscan-header">Other</th></tr><tr id="csscan-row-overflow"><td id="csscan-property-overflow" class="csscan-property">overflow</td><td id="csscan-value-overflow" class="csscan-value"></td></tr><tr id="csscan-row-cursor"><td id="csscan-property-cursor" class="csscan-property">cursor</td><td id="csscan-value-cursor" class="csscan-value"></td></tr><tr id="csscan-row-visibility"><td id="csscan-property-visibility" class="csscan-property">visibility</td><td id="csscan-value-visibility" class="csscan-value"></td></tr></tbody></table></div></body></html>
the XPath above is correct as i have checked it with FirePath. can anyone tell me what i am doing wrong?
Try to use loadHTML($string) instead of loadXML. From manual:
The function parses the HTML contained in the string source. Unlike loading XML, HTML does not have to be well-formed to load.
Update 1
loadHTML creates the same DOM tree in memory as loadXML does. It only uses less strict parser. Here is example code with XPath:
<?php
$content = file_get_contents("1.html");
$page = new DOMDocument();
$page->loadHTML($content); // this will ignore most errors in formating
echo $page->saveHTML();
echo "=====\n";
$xpath = new DOMXPath($page); // use any "XML" parsing function
foreach ($xpath->query("//li[not(#id='3')]") as $elem) {
echo "[".trim($elem->textContent)."]\n";
}
Content of 1.html file is:
<li id="1">item 1
<li id="2">item 2
<li id="3">item 3
<li id="4">item 4
Output will be:
<!DOCTYPE html PUBLIC "...">
<html><body>
<li id="1">item 1
</li>
<li id="2">item 2
</li>
<li id="3">item 3
</li>
<li id="4">item 4
</li>
</body></html>
=====
[item 1]
[item 2]
[item 4]
Update 2
You just missed initializing for $xpath variable. I've also removed getXHTML call, because it's not necessary:
$content = file_get_contents("2.html");
$page = new DOMDocument();
//$content=getXHTML($content); // no need this if you're using loadHTML
$page->loadHTML($content);
$totalPath = "//body/table[3]/tbody/tr[1]/td[4]";
$xpath = new DOMXPath($page); // creating $xpath object
$total = $xpath->query($totalPath);
echo "[",$total->length,"]";
How much have you played with the PHP Tidy options? If the error you get refers to entities (specifically ) I wonder if setting numeric-entities "on" or playing with the value for preserve-entities would help.
Plan B: Try this. XPath worked even with poorly formed html files.
<?php
$oldSetting = libxml_use_internal_errors( true );
libxml_clear_errors();
$html = new DOMDocument();
$html->loadHtmlFile(
'myHtmlFile.html');
$xpath = new DOMXPath( $html );
$test = $xpath->query( "//div[#id='mydiv']" );
$div = $test->item(0);
echo $div->getAttribute('style');
libxml_clear_errors();
libxml_use_internal_errors( $oldSetting );
?>
the answer to the above question somewhat tricky. my original code looked something like
$xpath=new DOMXPath($page);
..
...
...
$page->loadHTML($content);
..
...
$totalPath = "//body/table[3]/tbody/tr[1]/td[4]";
$total = $xpath->query($totalPath);
...
...
what happens above is that $xpath is created on an empty document because the html is still not loaded in the Dom. so when xpath ran any query it ran the query on an empty document.
now i changed the order of the 2 statements
...
...
$page->loadHTML($content);
$xpath=new DOMXPath($page);
...
...
$totalPath = "//body/table[3]/tbody/tr[1]/td[4]";
$total = $xpath->query($totalPath);
now it works because $xpath is created on a nonempty document

Categories