PHP Table into array - php

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.)

Related

Simple Dom Parser or CURL TABLE PARSING

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"

Cannot Modify Header Iformation

I am getting this error:
Warning: Cannot modify header information - headers already sent by (output started at /home/renta142/public_html/includes/connection_prop.php:14) in /home/renta142/public_html/login.php on line 31
My PHP Code is:
<?php
session_start();
if($_SESSION['user']['id']!=""){
header("location:index.php");
exit();
}
$login_email=$_POST[email];
$username=$_POST[username1];
$name=$_POST[name];
$er=$_POST[er];
if(trim($_POST["SignIn"])=="Sign In"){
include("includes/connection_user.php");
$user_=$_POST["username"];
$pass=$_POST["pass"];
$query=mysql_query("select * from user_registration where UserID='".$user_."' and Password='".$pass."' and Display='1'");
$result=mysql_fetch_array($query);
if(!strcmp($result[Password],$pass)){
$_SESSION['user']['id'] = $result[AID];
$_SESSION['user']['password'] = $result[Password];
$_SESSION['user']['username'] = $result[UserID];
$_SESSION['user']['name']=$result[Name];
$ref=$_SESSION["refer_url"];
if($_REQUEST['ref']=="sell"){
header("Location:postproperty_sell.php");
exit();
}
else if($ref==""){
header("Location:postproperty.php");
exit();
}
else{
header("Location:$ref");
exit();
}
}else{
$errsg="Invalid Username and Password !";
}
mysql_close();
}
include("config.php");
$sitename=ucfirst($thirdsite)." - Property in ".ucfirst($addresscity);
$keys="property in ".ucfirst($addresscity);
$desc="Real estate agents offers - property in ".ucfirst($addresscity);
include("includes/header.php");
include("includes/left.php");
?>
<script language='javascript' src="images/script.js"></script>
<script type="text/javascript">
function popUp_file(URL){
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=1,statusbar=0,menubar=0,resizable=0,width=900,height=600');");
}
<?php if($_REQUEST[fcode]=='wrong'){?>
window.onload=function(){document.getElementById('fpass').style.display='block';}
<?php }?>
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<td valign="top" align="center" colspan="2">
<table width="794" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" align="right" valign="bottom"><img src="images/11.jpg" width="10" height="10" alt="" /></td>
<td width="97%" style="background:url(images/12.jpg) repeat-x bottom;"> </td>
<td width="2%" align="left" valign="bottom"><img src="images/13.jpg" width="10" height="10" alt="" /></td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" class="green"> </td>
<td> </td>
</tr>
<tr>
<td align="left" valign="middle" class="green"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="5%"><img src="images/customer_login.gif" alt="CUSTOMER LOGIN" width="24" height="23" /></td>
<td width="92%">PROPERTY OWNER LOGIN </td>
</tr>
</table></td>
<td align="left" class="green"><table width="100%" border="0" cellpadding="00" cellspacing="0">
<tr>
<td width="5%"><img src="images/mbenifites.gif" alt="MEMBERSHIP BENEFITS" width="16" height="17" /></td>
<td width="92%"> FREE MEMBERSHIP BENEFITS</td>
</tr>
</table></td>
</tr>
<tr>
<td valign="top"> </td>
<td valign="top"> </td>
</tr>
<tr>
<td width="50%" valign="top"><?php if($errsg){ echo "<br /><div class='alert' align='center'>".$errsg."</div><br />"; } ?>
<table width="100%" cellpadding="4" cellspacing="1" class="heading" valign="top">
<form action="login.php?ref=<?php echo $_REQUEST['ref']; ?>" method="post" name="signin" id="signin" onsubmit="return loginform();">
<tr>
<td class="txt">Username<font color="red">*</font></td>
<td width="1" align="left"><strong>:</strong></td>
<td align="left"><input name="username" type="text" id="username" onfocus="if(this.value=='Username') this.value='';" onblur="if(this.value=='') this.value='Username';" value="Username" /></td>
</tr>
<tr>
<td class="txt">Password<font color="red">*</font></td>
<td align="left"><strong>:</strong></td>
<td align="left"><input type="password" name="pass" onfocus="if(this.value=='**********') this.value='';" onblur="if(this.value=='') this.value='**********'" value="**********" /></td>
</tr>
<tr>
<td> </td>
<td align="left"> </td>
<td align="left"><input type="submit" name="SignIn" value="Sign In" class="button" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td align="left"><font color="#333333" size="2" face="Arial, Helvetica, sans-serif"> <img src="images/nuser.gif" alt="New User registration" width="19" height="21" alt="" /> New User ?</font><a href="login.php#reg"><font color="#0000FF" size="2" face="Arial, Helvetica, sans-serif">Register First</font><br />
</a> <font color="#0000FF" size="2" face="Arial, Helvetica, sans-serif">Forgot Password </font></td>
</tr>
</form>
</table></td>
<td width="50%" valign="top" style="background:url(images/login_page.jpg) no-repeat right; height:200px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"><table width="100%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="11%" align="center" valign="top" style="padding-top:8px;"><img src="images/bullet-cir1.jpg" width="8" height="8" alt="" /></td>
<td width="89%" valign="top"><font size="2" face="Arial, Helvetica, sans-serif">Advertise your properties for Sale/Rent/PG </font></td>
</tr>
<tr>
<td align="center" valign="top" style="padding-top:8px;"><img src="images/bullet-cir1.jpg" width="8" height="8" alt="" /></td>
<td valign="top"><font size="2" face="Arial, Helvetica, sans-serif">Get Special offers and freebies</font></td>
</tr>
<tr>
<td align="center" valign="top" style="padding-top:8px;"><img src="images/bullet-cir1.jpg" width="8" height="8" alt="" /></td>
<td valign="top"><font size="2" face="Arial, Helvetica, sans-serif">Get updates on our new products</font></td>
</tr>
<tr>
<td align="center" valign="top" style="padding-top:8px;"><img src="images/bullet-cir1.jpg" width="8" height="8" alt="" /></td>
<td valign="top"><font size="2" face="Arial, Helvetica, sans-serif">Response through mail, phone</font></td>
</tr>
</table> </td>
</tr>
</table></td></tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" ><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="border:#3399FF 1px solid;">
<tr>
<td align="left" bgcolor="#E1F1F4" style="padding-left:3px; padding-right:3px;"> <strong><font size="2" face="Arial, Helvetica, sans-serif"><img src="images/note.gif" alt="<?php echo $thirdsite ?>is commited your information is strictly confidential, unless you want to expose it." width="19" height="18" /> Note:</font></strong></td>
</tr>
<tr>
<td align="center" bgcolor="#E1F1F4" style="padding-left:3px; padding-right:3px;"><div align="justify" style="padding-left:3px; padding-right:3px;"><font color="#666666" size="2" face="Arial, Helvetica, sans-serif"> <?php echo ucfirst($thirdsite); ?> is commited your information is strictly confidential, unless you want to expose it.</font></div></td>
</tr>
<tr>
<td align="center" bgcolor="#E1F1F4"> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table></td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td align="right" valign="top"><img src="images/31.jpg" width="10" height="10" alt="" /></td>
<td style="background:url(images/32.jpg) repeat-x top;"> </td>
<td align="left" valign="top"><img src="images/33.jpg" width="10" height="10" alt="" /></td>
</tr>
</table></td>
</tr>
<tr>
<td></td>
</tr>
</table>
<a name="fp"></a>
<div id="fpass" style="display:none;">
<table width="794" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" align="right" valign="bottom"><img src="images/11.jpg" width="10" height="10" alt="" /></td>
<td width="97%" style="background:url(images/12.jpg) repeat-x bottom;"> </td>
<td width="2%" align="left" valign="bottom"><img src="images/13.jpg" width="10" height="10" alt="" /></td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left"> </td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left"><table width="100%" border="0" cellpadding="00" cellspacing="0">
<tr>
<td width="3%"><span class="green"><img src="images/forget_pass.gif" alt="FORGOT PASSWORD" width="20" height="19" /></span></td>
<td width="97%"><span class="green"> FORGOT PASSWORD</span></td>
</tr>
</table></td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td><table width="100%" border="0" align="right" cellpadding="2" cellspacing="0">
<form action="forget_password_submit.php" method="post" name="forget_password" id="forget_password">
<input type="hidden" name="chk" value="2" />
<?php if($_GET[fcode]) echo ' <tr>
<td class="alert" align="center" colspan="3">Your EmailID or UserName Is Not Found In Our Database, Please Try Again!!!</td></tr>';?>
<tr >
<td width="20%" align="right" valign="top" class="txt"> Username</td>
<td width="2%" valign="top"><b>:</b></td>
<td width="78%" align="left" valign="top"><input type="text" name="username1" /></td>
</tr>
<tr>
<td colspan="2" align="right" class="heading"> OR</td>
<td class="heading" align="left"> </td>
</tr>
<tr>
<td align="right" valign="top" class="txt"> Email-ID</td>
<td valign="top"><b>:</b></td>
<td align="left" valign="top"><input type="text" name="email1" /></td>
</tr>
<tr>
<td colspan="3" align="right" height="8"></td>
</tr>
<tr>
<td align="right"> </td>
<td align="center"> </td>
<td align="left"><input name="submit" type="submit" onclick="return ForgetpassForm();" value="Submit" class="button" /></td>
</tr>
<tr>
<td align="right"> </td>
<td align="right"> </td>
<td align="left"><font color="#333333" size="2" face="Arial, Helvetica, sans-serif"><img src="images/login.gif" alt="Existin user login" width="19" height="21" /></font> <font color="#0000FF" size="2" face="Arial, Helvetica, sans-serif"><strong>Login</strong></font></td>
</tr>
<tr>
<td align="right" colspan="4" height="8"></td>
</tr>
<tr>
<td colspan="3" align="right"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="border:#3399FF 1px solid;">
<tr>
<td align="left" bgcolor="#E1F1F4" style="padding-left:3px; padding-right:3px;"> <strong><font size="2" face="Arial, Helvetica, sans-serif"><img src="images/note.gif" alt="Enter Your UserName or Email-ID which you had entered in registration form and get your password through eMail." width="19" height="18" /></font></strong><strong><font size="2" face="Arial, Helvetica, sans-serif"> Note:</font></strong></td>
</tr>
<tr>
<td align="center" bgcolor="#E1F1F4" style="padding-left:3px; padding-right:3px;"><div align="justify" style="padding-left:3px; padding-right:3px;"><span class="text"> Enter Your UserName or Email-ID which you had entered in registration form and get your password through eMail. </span></div></td>
</tr>
<tr>
<td align="center" bgcolor="#E1F1F4"> </td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="3" align="center" height="7"></td>
</tr>
</form>
</table></td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td align="right" valign="top"><img src="images/31.jpg" width="10" height="10" alt="" /></td>
<td style="background:url(images/32.jpg) repeat-x top;"> </td>
<td align="left" valign="top"><img src="images/33.jpg" width="10" height="10" alt="" /></td>
</tr>
</table></td>
</tr>
</table>
</div>
<?php //if($errsg=="Invalid Username and Password !"){?>
<a name="reg"></a>
<table width="794" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" align="right" valign="bottom"><img src="images/11.jpg" width="10" height="10" alt="" /></td>
<td width="97%" style="background:url(images/12.jpg) repeat-x bottom;"> </td>
<td width="2%" align="left" valign="bottom"><img src="images/13.jpg" width="10" height="10" alt="" /></td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left"> </td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left" class="heading"><table width="100%" border="0" cellpadding="00" cellspacing="0">
<tr>
<td width="3%"><img src="images/if_you_do.gif" alt="If you do not have an existing Customer Account with us fill in the form below" width="19" height="19" /></td>
<td width="97%"> If you do not have an existing User Account with us fill in the form below. </td>
</tr>
</table></td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left"> </td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td align="right" valign="top"><img src="images/31.jpg" width="10" height="10" alt="" /></td>
<td style="background:url(images/32.jpg) repeat-x top;"> </td>
<td align="left" valign="top"><img src="images/33.jpg" width="10" height="10" alt="" /></td>
</tr>
</table></td>
</tr>
</table>
<table width="794" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" align="right" valign="bottom"><img src="images/11.jpg" width="10" height="10" alt="" /></td>
<td width="97%" style="background:url(images/12.jpg) repeat-x bottom;"> </td>
<td width="2%" align="left" valign="bottom"><img src="images/13.jpg" width="10" height="10" alt="" /></td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left" class="green"><table width="100%" border="0" cellpadding="00" cellspacing="0">
<tr>
<td width="5%"><img src="images/NEW-USER-REGISTER-FORM.gif" alt="NEW USER REGISTER FORM " width="26" height="27" /></td>
<td width="97%"> NEW USER REGISTER FORM </td>
</tr>
</table></td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left"> </td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td style="background:url(images/21.jpg) repeat-y right;"> </td>
<td align="left"><form name="register" method="POST" action="registration_submit.php?ref=<?php echo $_REQUEST['ref']; ?>" onsubmit="return registerForm();">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" valign="top" style="border:#CCCCCC 1px solid;">
<table width="100%" cellpadding="4" cellspacing="0">
<tr>
<td bgcolor="#EEEEEE"><font size="2" face="Arial, Helvetica, sans-serif">User Login Information</font></td>
<td bgcolor="#EEEEEE"> </td>
<td align="right" bgcolor="#EEEEEE"><span class="alert">* Mandatory Fields</span></td>
</tr>
<tr>
<td width="39%" class="tdspace txt"><font color="red">*</font>Username</td>
<td width="3%">:</td>
<td width="58%"><input name="username" type="text" id="username" size="25" /></td>
</tr>
<tr>
<td class="tdspace txt"><font color="red">*</font>Password</td>
<td>:</td>
<td><input type="password" name="password" size="25" /></td>
</tr>
<tr>
<td class="tdspace txt"><font color="red">*</font>Confirm Password</td>
<td>:</td>
<td><input type="password" name="rpassword" size="25" /></td>
</tr>
<tr>
<td class="tdspace txt"><font color="red">*</font>Email-ID</td>
<td>:</td>
<td><input type="text" name="email" size="25" /></td>
</tr>
<tr>
<td colspan="3" bgcolor="#EEEEEE"><font size="2" face="Arial, Helvetica, sans-serif">Contact Information</font></td>
</tr>
<tr>
<td class="tdspace txt"><font color="red">*</font>Name</td>
<td>:</td>
<td><input type="text" name="name" size="25" /></td>
</tr>
<tr>
<td class="tdspace txt"><font color="red">*</font>Verification Code</td>
<td>:</td>
<td><input name="verify_code" type="text" size="15" />
<img src="verificationimage.php" alt="verification image, type it in the box" width="60" height="30" align="absbottom"/></td>
</tr>
<tr>
<td colspan="3" class="text"><input type="checkbox" name="term" />
I have read <font color="red">Terms and Conditions</font> and I accept these conditions.</td>
</tr>
<tr>
<td align="center"> </td>
<td align="center"> </td>
<td align="left"><input name="submit2" type="submit" value="Submit" class="button" />
<input name="reset" type="reset" value="Reset" class="button" />
<input name="flg" type="hidden" id="flg" value="1" /></td>
</tr>
</table></td>
<td width="1%" > </td>
<td width="49%" valign="top"><img src="images/register.jpg" alt="For Free registration on <?php echo ucfirst($thirdsite); ?>, Advertise your properties for Sale/Rent/PG, Get Special offers and freebies, Get updates on our new products, Response through mail, phone" width="380" height="380" /></td>
</tr>
</table>
</form></td>
<td style="background:url(images/22.jpg) repeat-y left;"> </td>
</tr>
<tr>
<td align="right" valign="top"><img src="images/31.jpg" width="10" height="10" alt="" /></td>
<td style="background:url(images/32.jpg) repeat-x top;"> </td>
<td align="left" valign="top"><img src="images/33.jpg" width="10" height="10" alt="" /></td>
</tr>
</table></td>
</tr>
</table>
<?php //}?>
</td>
<script language='javascript'>signin.username.focus();</script>
<?php
//include("includes/right.php");
include("includes/footer.php");
?>
public_html/includes/connection_prop.php:14 is probably outputting some blank spaces. Check that file and other includes for whitespace around tags.
You cannot send headers if any text has already been output

Regex to read Table Rows contents in Array - PHP

Is there any Regex to Read the <td> contents from the following Table, note that there are many similar tables so i want only to read the following table contents.
I want to READ data from 3,4,5 TD from all <TR>
My regex looks like following but doesnt work
$match = preg_replace('~<td width="80" bgcolor="#F3F3E4" align="left"> <a onmouseout="ChangeImage(AE1,1)" onmouseover="ChangeImage(AE1,0)" href="/charts/livegold.html">GOLD</a></td>#[a-z0-9]{6}~i','',$match[3]);
echo '<table><tr>' . $match . '</tr></table>';
the table is as follows
<table width="540" cellspacing="1" cellpadding="0" border="0" align="center">
<tbody><tr>
<td width="16" bgcolor="#000000" align="center"> </td>
<td width="80" bgcolor="#000000" align="center"><font size="1" face="Arial, Helvetica, sans-serif" color="#FFFFFF">www.kitco.com</font></td>
<td width="369" bgcolor="#000000" align="center" colspan="5"><p class="white">The World Spot Price - Asia/Europe/NY markets</p></td>
<td width="73" bgcolor="#000000" align="right"><img width="39" vspace="0" hspace="0" height="17" border="0" alt="light" src="/images/lightgreen.gif"></td>
</tr>
<tr>
<td width="16" bgcolor="#000000" align="center"> </td>
<td width="522" bgcolor="#F3F3E4" align="center" colspan="7"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><b><font color="GREEN">MARKET IS OPEN</font><br>(Will close in 17 hrs. 41 mins.)<!-- 1486.00--></b></font></td>
</tr>
<tr bgcolor="#F3F3E4">
<td width="16" bgcolor="#000000" align="center"> </td>
<td width="80" bgcolor="#CCCC99" align="center">Metals</td>
<td width="80" bgcolor="#CCCC99" align="center">Date</td>
<td width="80" bgcolor="#CCCC99" align="center">Time (EST)</td>
<td width="68" bgcolor="#CCCC99" align="center">Bid</td>
<td width="68" bgcolor="#CCCC99" align="center">Ask</td>
<td width="146" bgcolor="#CCCC99" align="center" colspan="2">Change from NY Close</td>
</tr>
<tr bgcolor="#F3F3E4">
<td width="16" bgcolor="#000000" align="center"><a onmouseout="ChangeImage('AE1','1')" onmouseover="ChangeImage('AE1','0')" href="/charts/livegold.html"><img width="16" vspace="0" hspace="0" height="13" border="0" alt="Gold Charts" name="AE1" src="http://www.kitco.com/images/graph_down.gif"></a></td>
<td width="80" bgcolor="#F3F3E4" align="left"> <a onmouseout="ChangeImage('AE1','1')" onmouseover="ChangeImage('AE1','0')" href="/charts/livegold.html">GOLD</a></td>
<td width="80" align="center">06/04/2013</td>
<td width="80" align="center">23:34</td>
<td width="68" align="center">1405.50</td>
<td width="68" align="center">1406.50</td>
<td width="73" align="center"><p class="spotgreen">+5.50</p></td>
<td width="73" align="center"><p class="spotgreen">+0.39%</p></td>
</tr>
<tr bgcolor="#F3F3E4">
<td width="16" bgcolor="#000000" align="center"><a onmouseout="ChangeImage('AE2','1')" onmouseover="ChangeImage('AE2','0')" href="/charts/livesilver.html"><img width="16" vspace="0" hspace="0" height="13" border="0" alt="Silver Charts" name="AE2" src="http://www.kitco.com/images/graph_down.gif"></a></td>
<td width="80" align="left"> <a onmouseout="ChangeImage('AE2','1')" onmouseover="ChangeImage('AE2','0')" href="/charts/livesilver.html">SILVER</a></td>
<td width="80" align="center">06/04/2013</td>
<td width="80" align="center">23:34</td>
<td width="68" align="center">22.59</td>
<td width="68" align="center">22.69</td>
<td width="73" align="center"><p class="spotgreen">+0.05</p></td>
<td width="73" align="center"><p class="spotgreen">+0.20%</p></td>
</tr>
<tr bgcolor="#F3F3E4">
<td width="16" bgcolor="#000000" align="center"><a onmouseout="ChangeImage('AE3','1')" onmouseover="ChangeImage('AE3','0')" href="/charts/liveplatinum.html"><img width="16" vspace="0" hspace="0" height="13" border="0" alt="Platinum Charts" name="AE3" src="http://www.kitco.com/images/graph_down.gif"></a></td>
<td width="80" align="left"><p> <a onmouseout="ChangeImage('AE3','1')" onmouseover="ChangeImage('AE3','0')" href="/charts/liveplatinum.html">PLATINUM</a></p></td>
<td width="80" align="center">06/04/2013</td>
<td width="80" align="center">23:34</td>
<td width="68" align="center">1501.00</td>
<td width="68" align="center">1509.00</td>
<td width="73" align="center"><p class="spotgreen">+9.00</p></td>
<td width="73" align="center"><p class="spotgreen">+0.60%</p></td>
</tr>
<tr bgcolor="#F3F3E4">
<td width="16" bgcolor="#000000" align="center"><a onmouseout="ChangeImage('AE4','1')" onmouseover="ChangeImage('AE4','0')" href="/charts/livepalladium.html"><img width="16" vspace="0" hspace="0" height="13" border="0" alt="Palladium Charts" name="AE4" src="http://www.kitco.com/images/graph_down.gif"></a></td>
<td width="80" align="left"> <a onmouseout="ChangeImage('AE4','1')" onmouseover="ChangeImage('AE4','0')" href="/charts/livepalladium.html">PALLADIUM</a></td>
<td width="80" align="center">06/04/2013</td>
<td width="80" align="center">23:25</td>
<td width="68" align="center">755.00</td>
<td width="68" align="center">761.00</td>
<td width="73" align="center"><p class="spotgreen">+6.00</p></td>
<td width="73" align="center"><p class="spotgreen">+0.80%</p></td>
</tr>
</tbody></table>
Here is the data i want to Extract
ok here is the solution with Regex:
$patt = "/<td[^>]*width=['\"]68['\"][^>]*>([0-9\.]+)<\/td>\s*<td[^>]*width=['\"]68['\"][^>]*>([0-9\.]+)<\/td>/i";
if(preg_match_all($patt, $html, $matches))
{
//print all records
//print_r($matches);
for($i=0; $i<count($matches[1]); $i++)
{
echo "Bid: ".$matches[1][$i].", Ask: ".$matches[2][$i]."\n";
}
}
You can use some HTML parser. For PHP there is one http://simplehtmldom.sourceforge.net/
Once the DOM has been loaded into library, get through the TABLE element and iterate through each TR element.

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

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