Simple Dom Parser or CURL TABLE PARSING - php

I need help to get the data from a table. It's an internet usage table and the html code is down below :
<table width="572" border="0" align="center" cellspacing="0">
<tbody><tr valign="top">
<td width="1" class="bgsidelines"></td>
<td width="*" class="bgbottom">
<table summary="" width="100%" border="0" cellpadding="0">
<tbody><tr>
<td width="10" rowspan="2" bgcolor="#CCCCCC"></td>
<td width="443">
<table width="443" height="10" border="0" align="center" cellpadding="8">
<tbody>
<tr>
<td width="100%" class="path"><b>Internet usage</b></td>
</tr>
<tr>
<td class="reg"><!-- Begin yours codes -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tbody><tr>
<table cellpadding="5" cellspacing="1" border="0">
<tbody>
<tr>
<td width="43" bgcolor="#EEEEEE" class="grey"><b><center>MB</center></b>
</td>
<td width="44" bgcolor="#EEEEEE" class="grey"><b><center>GB</center></b>
</td>
<td width="44" bgcolor="#EEEEEE" class="grey"><b><center>MB</center></b>
</td>
<td width="44" bgcolor="#EEEEEE" class="grey"><b><center>GB</center></b>
</td>
<td width="60" bgcolor="#EEEEEE" class="grey"><b><center>MB</center></b>
</td>
<td width="60" bgcolor="#EEEEEE" class="grey"><b><center>GB</center></b>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="reg" nowrap="nowrap">2017-06-01 to<br>2017-
06-18</td>
<td bgcolor="#FFFFFF" align="right" valign="top" class="reg">54815.06</td>
<td bgcolor="#FFFFFF" align="right" valign="top" class="reg">53.53</td>
<td bgcolor="#FFFFFF" align="right" valign="top" class="reg">52114.59</td>
<td bgcolor="#FFFFFF" align="right" valign="top" class="reg">50.89</td>
<td bgcolor="#FFFFFF" align="right" valign="top" class="reg">106929.65</td>
<td bgcolor="#FFFFFF" align="right" valign="top" class="reg">104.42</td>
</tr>
</tbody></table></td></tr>
</tbody></table>
<!-- End yours codes -->
</tr>
</tbody></table></td></tr>
</tbody></table></td></tr>
</tbody></table>
I've done it in a way that works but only works sometimes, this must be due to the user agent. and it fetches the entire table while I would like each separated values for the internet usage, the ones in the td class="reg" (54815.06, 53.53..) It's hard because there is a table in table.. Also it's
My PHP :
require_once 'advanced_html_dom.php';
$numvl = $_POST['numvl'];
$url =
'https://extranet.videotron.com/services/secur/extranet/tpia/Usage.do?
compteInternet='.$numvl;
$html = new AdvancedHtmlDom();
$html->load_file($url);
$element = $html->find("tr");
echo $element[1]->innertext;

no need for some external lib (advanced_html_dom.php? never heard of), just use PHP's DOMDocument and DOMXPath.
example:
<?php
declare(strict_types=1);
$domd=#DOMDocument::loadHTML(getHTML());
$xpath=new DOMXPath($domd);
foreach($xpath->query("//td[#valign='top' and #class='reg']") as $ele){
var_dump($ele->textContent);
}
function getHTML():string{
$html=<<<'HTML'
<table width="572" border="0" align="center" cellspacing="0">
<tbody><tr valign="top">
<td width="1" class="bgsidelines"></td>
<td width="*" class="bgbottom">
<table summary="" width="100%" border="0" cellpadding="0">
<tbody><tr>
<td width="10" rowspan="2" bgcolor="#CCCCCC"></td>
<td width="443">
<table width="443" height="10" border="0" align="center" cellpadding="8">
<tbody>
<tr>
<td width="100%" class="path"><b>Internet usage</b></td>
</tr>
<tr>
<td class="reg"><!-- Begin yours codes -->
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tbody><tr>
<table cellpadding="5" cellspacing="1" border="0">
<tbody>
<tr>
<td width="43" bgcolor="#EEEEEE" class="grey"><b><center>MB</center></b>
</td>
<td width="44" bgcolor="#EEEEEE" class="grey"><b><center>GB</center></b>
</td>
<td width="44" bgcolor="#EEEEEE" class="grey"><b><center>MB</center></b>
</td>
<td width="44" bgcolor="#EEEEEE" class="grey"><b><center>GB</center></b>
</td>
<td width="60" bgcolor="#EEEEEE" class="grey"><b><center>MB</center></b>
</td>
<td width="60" bgcolor="#EEEEEE" class="grey"><b><center>GB</center></b>
</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" class="reg" nowrap="nowrap">2017-06-01 to<br>2017-
06-18</td>
<td bgcolor="#FFFFFF" align="right" valign="top" class="reg">54815.06</td>
<td bgcolor="#FFFFFF" align="right" valign="top" class="reg">53.53</td>
<td bgcolor="#FFFFFF" align="right" valign="top" class="reg">52114.59</td>
<td bgcolor="#FFFFFF" align="right" valign="top" class="reg">50.89</td>
<td bgcolor="#FFFFFF" align="right" valign="top" class="reg">106929.65</td>
<td bgcolor="#FFFFFF" align="right" valign="top" class="reg">104.42</td>
</tr>
</tbody></table></td></tr>
</tbody></table>
<!-- End yours codes -->
</tr>
</tbody></table></td></tr>
</tbody></table></td></tr>
</tbody></table>
HTML;
return $html;
}
output:
string(8) "54815.06"
string(5) "53.53"
string(8) "52114.59"
string(5) "50.89"
string(9) "106929.65"
string(6) "104.42"

Related

Duplicated Results on SQL Query

PHP newbie here! I ve been struggling with this for a few days now and i have decided i cant figure this out on my own.
Basically i have 2 database tables "projects_2016" and "attachment".
I want to show the data of "projects_2016" to show in the top table and then check for a matching id number (and if it exsits) in "attachment" it will list all the results under the "project_2016 data".
At the moment it works great but it duplicates the "projects_2016" data for every "attachment" entry.
Here is my code, any input is appreciated!
PS not too concereded about Sql injections. Still learning that!
<?php include '../../../connection_config.php';
$sql = "SELECT DISTINCT * FROM attachment JOIN projects_2016 ON attachment.attachment_ABE_project_number = projects_2016.id ORDER BY `attachment_ABE_project_number` DESC";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
?>
<table width="20" border="1" cellspacing="0" cellpadding="2">
<tr>
<th height="0" scope="col"><table width="990" border="0" align= "center" cellpadding="3" cellspacing="0">
<tr class="text_report">
<td width="107" height="30" align="left" valign="middle" nowrap="nowrap" bgcolor="#F5F5F5"><strong>PNo</strong></td>
<td width="871" align="left" valign="middle" nowrap="nowrap" bgcolor="#F5F5F5"><strong>Project Name</strong></td>
</tr>
<tr>
<td height="20" align="left" valign="middle" bgcolor="#FFFFFF" class="text_report"><strong><?php echo "<br>". $row["ID"]. "<br>";?></strong></td>
<td height="20" align="left" valign="middle" bgcolor= "#FFFFFF" class="text_report"><strong><?php echo "<br>". $row["project_name"]. "<br>";?></strong></td>
</tr>
</table>
<?php
$photo_id = $row["ID"];
$contacts = "SELECT DISTINCT * FROM attachment WHERE attachment_ABE_project_number = '$photo_id'" ;
$result_contacts = $conn->query($contacts);
if ($result_contacts->num_rows > 0) {
// output data of each row
while($row_contacts = $result_contacts->fetch_assoc()) {
?>
<table width="990" border="0" align="center" cellpadding= "3" cellspacing="0" class="text_report">
<tr>
<td height="0" colspan="4" align="left" valign="middle" nowrap="nowrap" bgcolor="#FFFFFF"> </td>
</tr>
<tr>
<td width="319" height="30" align="left" valign="middle" nowrap="nowrap" bgcolor="#F5F5F5"><strong>File Name</strong></td>
<td width="279" align="left" valign="middle" nowrap="nowrap" bgcolor="#F5F5F5"><strong>File Type</strong></td>
<td width="315" align="left" valign="middle" nowrap="nowrap" bgcolor="#F5F5F5"><strong>File Size (KB)</strong></td>
<td width="53" align="right" valign="middle" nowrap="nowrap" bgcolor="#F5F5F5"><strong>View File</strong></td>
</tr>
<tr>
<td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><?php echo $row_contacts ['file'] ?></td>
<td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><?php echo $row_contacts ['type'] ?></td>
<td height="20" align="left" valign="middle" bgcolor="#FFFFFF"><?php echo $row_contacts ['size'] ?></td>
<td align="right" valign="middle" bgcolor="#FFFFFF">view file</td>
</tr>
<tr>
<td height="0" colspan="4" align="left" valign="middle" bgcolor="#FFFFFF"> </td>
</tr>
<?php
}
?>
</table>
<?php
}
?></th>
</tr>
</table>
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<th height="26"> </th>
</tr>
</table>
<p>
<?php
}
}
?>
</p>
</table>
<?php $conn->close();
?>
$sql = "SELECT * FROM projects_2016
WHERE EXISTS (SELECT * FROM attachment WHERE projects_2016.id = attachment_ABE_project_number) ORDER BY id DESC ";

Navigation table not aligning properly in Chrome

On one of my old sites, which has a pretty messy and outdated code, I am having problems with navigation menu in Chrome. It aligns perfectly in Firefox and IE but for some reason in Chrome only first 3 tabs get properly centered.
http://jsfiddle.net/8b2Cm/1/
<table width="765" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<td valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="19%"><img src="http://LINK" alt="" width="331" height="95" border="0"></td>
<td width="81%"><img src="http://LINK/images/logo.jpg" alt="" width="434" height="95"></td>
</tr>
</table>
</td>
<td valign="top" class="back1"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="1%"><img src="http://LINK/images/left-top.jpg" width="23" height="30" alt=""></td>
<td width="98%" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="90%" class="left-text11"><div align="center"> Home</div></td>
<td width="10%"><img src="http://LINK/images/line1.jpg" width="8" height="30" alt=""></td>
</tr>
</table></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="90%" class="left-text11"><div align="center" class="left-text11">
<? if(!$_SESSION['sbprj_userid'])
{
?><strong>Signup</strong>
<?
}else
{
?>My Account
<?
}
?></div></td>
<td width="10%"><img src="http://LINK/images/line1.jpg" width="8" height="30" alt=""></td>
</tr>
</table></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" width="90%" class="left-text11"><div align="center">Free Poker Money </div></td>
</tr>
</table></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10%"><img src="http://LINK/images/line1.jpg" width="8" height="30" alt=""></td>
</tr>
</table></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" width="90%" class="left-text11"><div align="center">Poker School</div></td>
</tr>
</table></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10%"><img src="http://LINK/images/line1.jpg" width="8" height="30" alt=""></td>
</tr>
</table></td>
<td class="left-text11"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="90%" class="left-text11"><div align="center">News </div></td>
<td width="10%"><img src="http://LINK/images/line1.jpg" width="8" height="30" alt=""></td>
</tr>
</table></td>
<td class="left-text11"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="90%" class="left-text11"><div align="center">Support </div></td>
<td width="10%"><img src="http://LINK/images/line1.jpg" width="8" height="30" alt=""></td>
</tr>
</table></td>
<td class="left-text11"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="90%" class="left-text11"><div align="center"><img src="http://LINK/images/facebook.png" border="0" width="28" height="25" /> <img src="http://LINK/images/twitter.png" border="0" width="28" height="25" /> <img src="http://LINK/images/googleplus.png" border="0" width="28" height="25" /></div></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="1%"><img src="http://LINK/images/right-top.jpg" width="24" height="30" alt=""></td>
</tr>
</table></td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top">
<td width="1%"><img src="http://LINK/images/top-1.jpg" width="23" height="17" alt=""></td>
<td width="98%" class="back2"><img src="http://LINK/images/back2.jpg" width="9" height="17" alt=""></td>
<td width="1%"><img src="http://LINK/images/right-1.jpg" width="24" height="17" alt=""></td>
</tr>
</table></td>
This is the code, any suggestions on how to fix this ?
There is a mess with separators.
Some separators are inside table(horizontal table with tabs, by the way, you should put only that table into fiddle and code, not whole the mess making for us harder to understand) cells, other separators come all alone in separate column, therefore they are taking the same place as column. Check it and move them, like it's done in first two tabs

Class not displaying correctly

This is the code I am using to display a row in a table:
$msg.='<tr class="'.$outclass.'" onClick="popticket('.$ticket['TicketID'].');" onmouseover="this.className='.$overclass.';" onmouseout="this.className='.$outclass.';" '.$reg1.' '.$reg2.' >
<td width="10%" align="center" class="style28" style="padding: 5px;">'.$ticket['TicketID'].'</td>
<td width="25%" align="left" class="style28">'.substr($ticket['customer_bus_name'], 0, 34).'</td>
<td width="12%" align="center" class="style28">'.$newpr.'</td>
<td width="15%" align="center" class="style28">'.$status.'</td>
<td class="style28">'.strip_tags($ticket['desc']).'</td>
<td width="60px" align="center" class="style28"><span style="display:none;">'.$ticket['updated'].'</span>'.$new_up.'</td>
<td width="45px" align="center" class="style28"><span style="display:none;">'.$ticket['scheduled'].'</span>'.$new_im.'</td>
</tr>';
Here each PHP variable has its own value. The problem is that the class given in the onmouseover and mouseout is not working.
I want to get this row as (this is the correct output):
<tr class="ticketrowsoutread" onmouseout="this.className='ticketrowsoutread';" onmouseover="this.className='ticketrowsover ticketrowsover2';" onclick="popticket('232');">
<td width="10%" align="center" class="style28" style="padding: 5px;">232</td>
<td width="25%" align="left" class="style28">net works</td>
<td width="12%" align="center" class="style28">Medium</td>
<td width="15%" align="center" class="style28">in progress</td>
<td class="style28">adsfasdf</td>
<td width="60px" align="center" class="style28"><span style="display:none;">1334709567</span>1 day</td>
<td width="45px" align="center" class="style28"><span style="display:none;">-</span></td>
</tr>
When I run my code it displays onmouseout="this.className=ticketrowsoutread;" instead of onmouseout="this.className='ticketrowsoutread';".
How can I get the desired output?
Add backslashes to escape the qote
onmouseover="this.className=\''.$overclass.'\';"

PHP Table into array

I´m trying to read a table from a HTML file into an array, I'm stuck.
Any help would be appreciated.
Every table element should be stored into 1 array value
example: $arr[1]= DER HE1 ges 1
PHP
<?php
libxml_use_internal_errors(true);
$i=0;
// new dom object
$dom = new DOMDocument();
//load the html
$html = $dom->loadHTMLFile("106642new.html");
//discard white space
$dom->preserveWhiteSpace = false;
//the table by its tag name
$tables = $dom->getElementsByTagName('table');
//get all rows from the table
$rows = $tables->item(0)->getElementsByTagName('tr');
// $test = $tables->item(0)->getElementsByTagName('td');
// loop over the table rows
foreach ($rows as $row) {
// get each column by tag name
$cols = $row->getElementsByTagName('td');
$i= $i + 1 ;
$value = "Nummer: ".$i.": ".$cols->item(0)->nodeValue.PHP_EOL;
// $value = "test: ".$i.": ".$cols->item(0)->nodeValue.PHP_EOL;
$cols = array(1, 2, 3, 4, 5);
echo $value;
// $cols[$i] = $row;
// echo the values
//echo $cols->item(0)->nodeValue ;
}
?>
HTML:
<body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">
<div align=left>
<table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%" height="100%">
<tr><td valign="top">&nbsp</td></tr>
<tr><td valign="top">
<p font class="Header">Basisrooster schooljaar 2011 2012 (m.i.v. 12-09-11)</font></p>
<br><div font class="lNameHeader"> </font> </div><table border=1>
<tr class="AccentDark">
<td align="left" width="65" class="tableHeader"></td>
<td align="center" width="auto" class="tableHeader">Maandag</td>
<td align="center" width="auto" class="tableHeader">Dinsdag</td>
<td align="center" width="auto" class="tableHeader">Woensdag</td>
<td align="center" width="auto" class="tableHeader">Donderdag</td>
<td align="center" width="auto" class="tableHeader">Vrijdag</td>
</tr><tr>
<td align="left" width="50" class="tableHeader">1e uur</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell"></td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell"></td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell"></td>
<td align="left" width="9" class="tableCell"></td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">WAS</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HE09</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">econ</td>
<td align="left" width="9" class="tableCell">5</td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">WIK</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HC17</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">biol</td>
<td align="left" width="9" class="tableCell">4</td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">OTT</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HC01</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">dutl</td>
<td align="left" width="9" class="tableCell">6</td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell"></td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell"></td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell"></td>
<td align="left" width="9" class="tableCell"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" width="50" class="tableHeader">2e uur</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">KEJ</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HC02</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">wisA</td>
<td align="left" width="9" class="tableCell">3</td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">BRT</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HE05</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">netl</td>
<td align="left" width="9" class="tableCell"></td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">OTT</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HC01</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">dutl</td>
<td align="left" width="9" class="tableCell">6</td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">BAU</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HG01</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">lo</td>
<td align="left" width="9" class="tableCell"></td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">MET</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HD02</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">entl</td>
<td align="left" width="9" class="tableCell"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" width="50" class="tableHeader">3e uur</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">WAS</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HE07</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">econ</td>
<td align="left" width="9" class="tableCell">5</td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">MET</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HD02</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">entl</td>
<td align="left" width="9" class="tableCell"></td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">WAS</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HE05</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">econ</td>
<td align="left" width="9" class="tableCell">5</td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">BAU</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HG01</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">lo</td>
<td align="left" width="9" class="tableCell"></td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">KEJ</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HC02</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">wisA</td>
<td align="left" width="9" class="tableCell">3</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" width="50" class="tableHeader">4e uur</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell"></td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell"></td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell"></td>
<td align="left" width="9" class="tableCell"></td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">DER</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HE08</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">ges</td>
<td align="left" width="9" class="tableCell">1</td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">KEJ</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HC06</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">wisA</td>
<td align="left" width="9" class="tableCell">3</td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">DER</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HE10</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">ges</td>
<td align="left" width="9" class="tableCell">1</td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">CHR</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HB15</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">ckv</td>
<td align="left" width="9" class="tableCell"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" width="50" class="tableHeader">5e uur</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">DOC</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HE09</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">m&o</td>
<td align="left" width="9" class="tableCell">2</td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell"></td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell"></td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell"></td>
<td align="left" width="9" class="tableCell"></td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">MET</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HD02</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">entl</td>
<td align="left" width="9" class="tableCell"></td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">BRT</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HE05</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">netl</td>
<td align="left" width="9" class="tableCell"></td>
</tr>
</table>
</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">OTT</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HC03</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">dutl</td>
<td align="left" width="9" class="tableCell">6</td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left" width="50" class="tableHeader">6e uur</td>
<td align="left" width="auto" class="tableCell"><table border="0" cellpadding="0" cellspacing="0" >
<tr>
<td align="left" width="41" class="tableCell">OTT</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="75" class="tableCell">HC03</td>
<td align="left" width="3" class="tableCell">&nbsp</td>
<td align="left" width="73" class="tableCell">dutl</td>
<td align="left" width="9" class="tableCell">6</td>
</tr>
</table>
</td>
If think the problem is that your first table is a container of other tables.
If you want to get the contents of all the tables, than you should also iterate through the tables list.
If you just want to get the contents of a inner table, than first try to locate it in the DOM. I suggest finding the first table, than geting all table elements inside that and iterate through them.
var_dump is a good starting point for debugging, you don't need anything else than you already did, just debug and test more :)
I'm guessing that the fact that it's invalid HTML/XML is screwing you over.
You're using the loadHTMLFile() function which might support malformed HTML up to an extent, but it might also need valid HTML/XML.
If it requires valid XML, then what's probably happening is that the "<br>" doesn't get interpreted as a stand-alone node, but rather as the starting point of a node... meaning that everything after that becomes sub-nodes of "<br>".
Furthermore this line here doesn't make any sense:
<p font class="Header">Basisrooster schooljaar 2011 2012 (m.i.v. 12-09-11)</font></p>
The <font> tag has been obsolete for years and should never be used, but more importantly it's not a font tag but a p-tag, that still also gets closed as if it's a font-tag. Just do:
<p class="Header">Basisrooster schooljaar 2011 2012 (m.i.v. 12-09-11)</p>
So the solution may be that your HTML/XML is invalid.
(Dan Bizdadea also has a good point.)

Email Div Content

I am trying to email the content of a Div. We have a booking system online and the user selects what options they want, then submit the form. It displays their information on the next page for them to print. I also want a copy of that emailed to them and us.
I liked the look of Jonathon Sampson's email div using ajax script. But it does not work for me. The email always comes back saying 'null' even if I give it a simple Div with one word written in it.
I do not know enough about PHP and have previously used CGI. THe problem with CGI is I cannot style the email. An the problem that I have found with PHP so far is that although I can add HTML to the email I cant decide what I want displayed where, and put returns from peoples forms inside DIVs in the HTML email.
If you take a look at the following page you will get a look at the Booking PAge. This page is where the initial form submission returns its information to. Everything inside the DIV tag 'booking-quote' I want emailed to the user one way or the other. Attached is the code
.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<div align="right" style="padding-top:10px;" id="booking_quote">
<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18" height="30" style="background:url(../../../IMAGES_A/Structure/Headers/blue-corner-piece-left-30px.gif); background-repeat:no-repeat;"> </td>
<td bgcolor="#263D51" style="border-left:1px solid #FFF; border-right:1px solid #FFF; padding-left:5px;"><div align="left" class="Text_normal" style="font-size:13px; color:#FFF;">Customer Records</div></td>
<td width="18" height="30" style="background:url(../../../IMAGES_A/Structure/Headers/blue-corner-piece-right-30px.gif); background-repeat:no-repeat;"> </td>
</tr>
</table></td>
</tr>
<tr>
<td style="padding-top:10px;"><div align="center">
<table width="755" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="500"><div align="left">
<table width="490" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="Corner-Box-WhiteGrey-TL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-T" height="6"></td>
<td class="Corner-Box-WhiteGrey-TR" height="6" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-L" width="6"></td>
<td width="478"><table width="478" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" valign="top"><div align="left" class="Text_normal">
<table width="230" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="77" valign="top" style="padding-right:12px;"><div align="right" style="color:#999;">Name</div></td>
<td width="153" valign="top" style="font-size:13px; line-height:22px; color:#333;"><div align="left"> <?php echo $_POST["CD_first-name"];?> <?php echo $_POST["CD_mid-initial"];?> <?php echo $_POST["CD_surname"];?></div></td>
</tr>
<tr>
<td valign="top" style="padding-right:12px;"><div align="right" style="color:#999;">Address</div></td>
<td valign="top" style="font-size:13px; color:#333;"><div align="left"> <?php echo $_POST["CD_address-L1"];?> <br />
<?php echo $_POST["CD_address-L2"];?> <br />
<?php echo $_POST["CD_address-settlement"];?><br />
<?php echo $_POST["CD_address-county"];?><br />
<?php echo $_POST["CD_address-post-code"];?><br />
<?php echo $_POST["CD_address-country"];?></div></td>
</tr>
</table>
</div></td>
<td width="50%" valign="top"><div align="right" class="Text_normal">
<table width="230" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="77" valign="top" style="padding-right:12px;"><div align="right" style="color:#999;">Date of Birth</div></td>
<td width="153" valign="top" style="font-size:13px; line-height:22px; color:#333;"><div align="left"> <?php echo $_POST["CD_DOB-day"];?>/<?php echo $_POST["CD_DOB-month"];?>/<?php echo $_POST["CD_DOB-year"];?></div></td>
</tr>
<tr>
<td valign="top" style="padding-right:12px;"><div align="right" style="color:#999;">Email</div></td>
<td valign="top" style="font-size:13px; line-height:22px; color:#333;"><div align="left"> <?php echo $_POST["CD_email"];?></div></td>
</tr>
<tr>
<td valign="top" style="padding-right:12px;"><div align="right" style="color:#999;">Telephone</div></td>
<td valign="top" style="font-size:13px; line-height:22px; color:#333;"><div align="left"> <?php echo $_POST["CD_telephone"];?></div></td>
</tr>
</table>
</div></td>
</tr>
</table></td>
<td class="Corner-Box-WhiteGrey-R" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-BL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-B" height="6"></td>
<td class="Corner-Box-WhiteGrey-BR" height="6" width="6"></td>
</tr>
</table>
</div></td>
<td width="255" valign="top"><div align="right">
<table width="250" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="Corner-Box-WhiteGrey-TL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-T" height="6"></td>
<td class="Corner-Box-WhiteGrey-TR" height="6" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-L" width="6"></td>
<td><div align="center" class="Text_normal">
<table width="230" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top" style="padding-right:12px;"><div align="left" style="color:#999;">Highest Current Qualifiacation</div></td>
</tr>
<tr>
<td valign="top" style="font-size:13px; line-height:22px; color:#333;"><div align="left"> <?php echo $_POST["CD_experience-qualifications"];?></div></td>
</tr>
<tr>
<td width="230" valign="top" style="padding-right:12px; padding-top:5px;"><div align="left" style="color:#999;">Total Logged Dives to Date</div></td>
</tr>
<tr>
<td valign="top" style="font-size:13px; line-height:22px; color:#333;"><div align="left"> <?php echo $_POST["CD_experience-dives"];?></div></td>
</tr>
</table>
</div></td>
<td class="Corner-Box-WhiteGrey-R" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-BL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-B" height="6"></td>
<td class="Corner-Box-WhiteGrey-BR" height="6" width="6"></td>
</tr>
</table>
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
<br />
<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="18" height="30" style="background:url(../../../IMAGES_A/Structure/Headers/blue-corner-piece-left-30px.gif); background-repeat:no-repeat;"> </td>
<td bgcolor="#263D51" style="border-left:1px solid #FFF; border-right:1px solid #FFF; padding-left:5px;"><div align="left" class="Text_normal" style="font-size:13px; color:#FFF;">Details</div></td>
<td width="18" height="30" style="background:url(../../../IMAGES_A/Structure/Headers/blue-corner-piece-right-30px.gif); background-repeat:no-repeat;"> </td>
</tr>
</table></td>
</tr>
<tr>
<td style="padding-top:10px;"><div align="center">
<table width="755" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="575"><div align="left" class="Text_normal">
<table width="565" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="Corner-Box-WhiteGrey-TL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-T" height="6"></td>
<td class="Corner-Box-WhiteGrey-TR" height="6" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-L" width="6"></td>
<td width="553"><table width="553" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="428" valign="top" style="padding-bottom:3px; border-bottom:1px solid #CCC;"><div align="left" class="Text_Sub_Title"><?php echo $_POST["programme"];?></div></td>
<td width="125" valign="top" style="padding-bottom:3px; border-bottom:1px solid #CCC;"><div align="right" class="Text_Sub_Title" style="color:#333;">£<?php echo $_POST["Prog_total"];?></div></td>
</tr>
<tr>
<td colspan="2" valign="top" style="padding-top:3px;"><ul>
<div><?php echo $_POST["Prog_Sum_Sub_Open_Water_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Open_Water_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Refresh_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Refresh_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Advanced_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dives_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Safari_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Safari_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_2"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_3"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_4"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_5"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_6"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Dive_Specialities_01_7"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Discover_Safari_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Discover_Safari_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Equipment_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Accommodation_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Accommodation_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Accommodation_01_2"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Accommodation_01_3"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_PADI_Materials_Fees_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_PADI_Materials_Fees_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Transfers_01_0"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Transfers_01_1"];?></div>
<div><?php echo $_POST["Prog_Sum_Sub_Transfers_01_2"];?></div>
</ul></td>
</tr>
</table></td>
<td class="Corner-Box-WhiteGrey-R" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-BL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-B" height="6"></td>
<td class="Corner-Box-WhiteGrey-BR" height="6" width="6"></td>
</tr>
</table>
<br />
<table width="565" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="Corner-Box-WhiteGrey-TL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-T" height="6"></td>
<td class="Corner-Box-WhiteGrey-TR" height="6" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-L" width="6"></td>
<td width="553"><table width="553" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="428" valign="top"><div align="left" class="Text_Sub_Title"><?php echo $_POST["Store_Dive_The_Gap_Equipment_Package"];?></div></td>
<td width="125" valign="top"><div align="right" class="Text_Sub_Title" style="color:#333;"><?php echo $_POST["Store_Dive_The_Gap_Equipment_Package_total"];?></div></td>
</tr>
<tr>
<td colspan="2" valign="top" style="padding-top:3px;"><ul>
<div>
<div><?php echo $_POST["Store_Dive_The_Gap_Equipment_Package_details"];?></div>
</div>
</ul></td>
</tr>
</table></td>
<td class="Corner-Box-WhiteGrey-R" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-BL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-B" height="6"></td>
<td class="Corner-Box-WhiteGrey-BR" height="6" width="6"></td>
</tr>
</table>
</div></td>
<td width="180" valign="top"><div align="right">
<table width="170" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6" colspan="3" valign="middle" class="Text_normal" style="background:url(../../../IMAGES_A/Structure/Headers/blue-Semicircle-170px.jpg); height:25px;"><div align="left" style="padding-left:20px; padding-top:4px; color:#FFF; font-size:13px; font-weight:bold;">Summary</div></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-L" width="6"></td>
<td width="158" bgcolor="#FFF"><div align="center" class="Text_normal" style="font-size:18px; color:#333; padding-top:12px; padding-bottom:12px; border-bottom:1px solid #CCC;">£<?php echo $_POST["Basket_Total"];?><span style="font-size:13px; color:#666; padding-left:4px;">incl. VAT</span></div>
<div align="center" class="Text_normal" style="font-size:12px; color:#666; padding-top:12px; padding-bottom:12px;"> <?php echo $_POST["Basket-Total-Duration-Text"];?><br />
<span style="font-size:10px; color:#666; padding-left:4px;">incl. arrival and departure day</span></div></td>
<td class="Corner-Box-WhiteGrey-R" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-BL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-B" height="6"></td>
<td class="Corner-Box-WhiteGrey-BR" height="6" width="6"></td>
</tr>
</table>
<br />
<table width="170" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="6" colspan="3" valign="middle" class="Text_normal" style="background:url(../../../IMAGES_A/Structure/Headers/blue-Semicircle-170px.jpg); height:25px;"><div align="left" style="padding-left:20px; padding-top:4px; color:#FFF; font-size:13px; font-weight:bold;">Start Date</div></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-L" width="6"></td>
<td width="158" bgcolor="#FFF"><div align="left" class="Text_basic" style="padding-top:12px; padding-bottom:12px;">
<div align="center"><span style="font-size:14px; color:#666; padding-left:10px;" align="left" id="Prog-Start-Date-Text"></span><span class="Text_normal" style="font-size:12px; color:#666; padding-top:12px; padding-bottom:12px;"><?php echo $_POST["Prog_start-date"];?></span></div>
</div></td>
<td class="Corner-Box-WhiteGrey-R" width="6"></td>
</tr>
<tr>
<td class="Corner-Box-WhiteGrey-BL" height="6" width="6"></td>
<td class="Corner-Box-WhiteGrey-B" height="6"></td>
<td class="Corner-Box-WhiteGrey-BR" height="6" width="6"></td>
</tr>
</table>
</div></td>
</tr>
</table>
</div></td>
</tr>
</table>
<br />
</div>
</body>
</html>
You have the id of the div as "booking_quote" in the HTML, not "booking-quote". Make sure you're using "booking-quote" in all places. Since you didn't attach the JavaScript code, it's hard to see what's going on, but the easiest thing would be to
Put a form tag on your page. Give it an id of "my-form" or whatever.
attach an event to your form's submit method
in the method, take the contents of the div and put them into a hidden form field
Using jQuery, it would be something like:
$('form#my-form').submit(function()
{
$('input#my-hidden-field').val($('div#booking-quote').text())
});
It sounds like you have magic quotes turned on in your PHP setup. Try wrapping your $message variable in stripslashes.

Categories