vikaspa Posted September 16, 2009 Share Posted September 16, 2009 I am displaying a table (displaying different fields from database tables) I want to send the very same table via by an email How can I do it ...Please please help Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/174483-store-html-tabl-in-php-variable/ Share on other sites More sharing options...
MatthewJ Posted September 16, 2009 Share Posted September 16, 2009 Put the code that outputs the table into a variable, then echo it on your page and mail it. Seems pretty straight forward. Best answer you can give with no code to look at Quote Link to comment https://forums.phpfreaks.com/topic/174483-store-html-tabl-in-php-variable/#findComment-919624 Share on other sites More sharing options...
Maq Posted September 16, 2009 Share Posted September 16, 2009 Check out heredoc. Quote Link to comment https://forums.phpfreaks.com/topic/174483-store-html-tabl-in-php-variable/#findComment-919625 Share on other sites More sharing options...
vikaspa Posted September 16, 2009 Author Share Posted September 16, 2009 The code to generate the table is given below . Since details are procured from various tables the making of table (fill up information in table) is rather completecated <?php $oquery="SELECT * FROM quotation WHERE id=".$_SESSION['newid']." "; mysql_select_db($database_DBconnect, $DBconnect); $oResult = mysql_query($oquery, $DBconnect) or die(mysql_error()); $orows = mysql_fetch_assoc($oResult); $ototalrows=mysql_num_rows($oResult); echo $oquery." ".$ototalrows." cust id ".$orows['company']." custemail ".$orows['custemail']; $cquery="SELECT * FROM company WHERE id=".$orows['company'] ; mysql_select_db($database_DBconnect, $DBconnect); $cResult = mysql_query($cquery, $DBconnect) or die(mysql_error()); $crows = mysql_fetch_assoc($cResult); $ctotalrows=mysql_num_rows($cResult); echo $crows['image1']; ?> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td height="29"><div align="left" class="heading"> <table width="100%" border="0" cellspacing="1"> <tr> <td width="14%"><img src="<?php echo "../".$crows['image1'];?>" /></td> <td width="86%" class="vardana16hdgorange"><div align="center"></div> <div align="left"><?php echo $crows['name']; ?></div></td> </tr> </table> </div></td> </tr> <tr> <td height="1" bgcolor="#FF3300"> </td> </tr> <tr> <td bgcolor="#FFFFFF" class="vardana12w"><strong>REF <?php echo $_SESSION['ordernumber'];?></strong></td> </tr> <tr> <td bgcolor="#FFFFFF" class="vardana12w"> Date : <?php echo changedate($orows['docdt']); ?></td> </tr> <tr> <td bgcolor="#FFFFFF" class="vardana12w">To,</td> </tr> <tr> <td bgcolor="#FFFFFF" class="vardana12w"> <?php echo Customername($orows['custid']); ?> <br /><?php echo nl2br($orows['address']); ?></td> </tr> <tr> <td height="27" bgcolor="#FFFFFF" class="vardana12w">Kind Attention :<?php echo Getcustomeremailname($orows['custemail']); ?> </td> </tr> <tr> <td height="27" bgcolor="#FFFFFF" class="vardana12w"><?php echo $orows['coveringnote']; ?></td> </tr> <?php if ( $orows['tc']==1) { ?> <tr> <td height="27" bgcolor="#FFFFFF" class="vardana12w"><?php echo $orows['tc']; ?></td> </tr> <?php } ?> <?php if ( $orows['sf']==1) { ?> <tr> <td height="27" bgcolor="#FFFFFF" class="vardana12w"><?php echo $orows['specialfeatures']; ?></td> </tr> <?php } ?> <tr> <td valign="top"> <table width="100%" border="0" cellspacing="1" cellpadding="1"> <?php $odquery="SELECT * FROM quotationproduct WHERE ordersid=".$_SESSION['newid']." "; mysql_select_db($database_DBconnect, $DBconnect); $odResult = mysql_query($odquery, $DBconnect) or die(mysql_error()); $odrows = mysql_fetch_assoc($odResult); $odtotalrows=mysql_num_rows($odResult); //echo $odquery." ".$odtotalrows; ?> <tr> <td class="bggrey"><table width="802"> <tr> <td colspan="11" class="heading_bg" >Product Details <input name="id" type="hidden" id="id" value="<?php echo $_SESSION['id'] ?>" size="12" /> </td> </tr> <tr> <td width="88" class="bodytextbold">Product Name </td> <td width="53" class="bodytextbold">Capacity</td> <td width="42" class="bodytextbold">min max Length </td> <td width="48" class="bodytextbold">Base Rate</td> <td width="49" class="bodytextbold">Extra rate </td> <td width="61" class="bodytextbold">Length</td> <td width="80" class="bodytextbold">Quantity<span class="vardana11"><span class="vardana11bold"> </span></span></td> <td width="83" class="bodytextbold">Product Cost </td> <td width="46" class="bodytextbold">Disc % </td> <td width="55" class="bodytextbold">Disc Amt </td> <td width="73" class="bodytextbold">Net Cost </td> </tr> <tr> <td colspan="11" height="2" bgcolor="#DFF3FD" ></td> </tr> <?php if ($odtotalrows>0 ) { $jj=0; do { $jj++; if ($jj==1) { $bgcolor="#ffffff";$jj=-1; } else { $bgcolor="#FBFEF9";$jj=0; } ?> <tr bgcolor="<?php echo $bgcolor;?>"> <td bgcolor="<?php echo $bgcolor;?>" class="vardana12w"> <?php echo Getprodcode($odrows['pid']);?> </td> <td bgcolor="<?php echo $bgcolor;?>" class="vardana12w"><span class="vardana11bold"><?php echo $odrows['capacity'] ;?></span></td> <td bgcolor="<?php echo $bgcolor;?>" class="vardana12w"><span class="vardana11bold"><?php echo $odrows['minln']."/".$odrows['maxln'];?></span></td> <td class="vardana12w"><span class="vardana11bold"><?php echo $odrows['baserate'];?></span></td> <td class="vardana12w"><span class="vardana11bold"><?php echo $odrows['ratepermeter'];?></span></td> <td bgcolor="<?php echo $bgcolor;?>" class="vardana12w"><span class="vardana11bold"><?php echo $odrows['ln'];?></span> </td> <td bgcolor="<?php echo $bgcolor;?>" class="vardana12w"> <?php echo $odrows['qty'];?> </td> <td bgcolor="<?php echo $bgcolor;?>" class="vardana12w"><span class="vardana11bold"><?php echo $odrows['productcost'];?></span></td> <td bgcolor="<?php echo $bgcolor;?>" class="vardana12w"> <?php echo $odrows['disc'];?> <input name="<?php echo "s".$odrows['id'];// Sling TYpe ?>" type="hidden" id="<?php echo "s".$odrows['id'];?>" value="<?php echo $odrows['pid'];?>" size="12" checknumeric(this)="checknumeric(this)" /> <span class="vardana11bold"> <input name="<?php echo "p". $odrows['pid'];//product id ?>" type="hidden" id="<?php echo "p". $odrows['pid'];?>" value="<?php echo $odrows['pid'];?>" size="12" /> </span><span class="vardana11bold"> <input name="<?php echo "i". $odrows['id'];//image id ?>" type="hidden" id="<?php echo "i". $odrows['id'];?>" value="<?php echo $odrows['image1'];?>" size="12" /> </span></td> <td bgcolor="<?php echo $bgcolor;?>" class="vardana12w"><span class="vardana11bold"><?php echo $odrows['discamt'];?></span></td> <td bgcolor="<?php echo $bgcolor;?>" class="vardana12w"><span class="vardana11bold"><?php echo $odrows['netcost'];?></span></td> </tr> <tr> <td colspan="11" height="4" ></td> </tr> <tr> <td colspan="11" height="1" bgcolor="#EAF5FD"></td> </tr> <tr> <td colspan="11" height="4" ></td> </tr> <?php } while ( $odrows = mysql_fetch_assoc($odResult)); } ?> </table></td> </tr> <tr> <td > </td> </tr> <tr> <td bgcolor="#000066" ><div align="center"> </div></td> </tr> </table> </form></td> </tr> </table> </td> </tr> </table> Quote Link to comment https://forums.phpfreaks.com/topic/174483-store-html-tabl-in-php-variable/#findComment-919654 Share on other sites More sharing options...
Maq Posted September 16, 2009 Share Posted September 16, 2009 1) Please use code tags next time. 2) Please only post the relevant code. 3) I don't know what this word means, "completecated". 4) Try to implement the suggestion that MatthewJ and I posted. Quote Link to comment https://forums.phpfreaks.com/topic/174483-store-html-tabl-in-php-variable/#findComment-919656 Share on other sites More sharing options...
vikaspa Posted September 16, 2009 Author Share Posted September 16, 2009 Thanks for the prompt rely and your suggestion Want i wish to conclude here is then table I am creating is complicated (complex) Hence I am asking can I write $var = output of the program say createtable.php This will simple for me to store details in a variable Quote Link to comment https://forums.phpfreaks.com/topic/174483-store-html-tabl-in-php-variable/#findComment-919663 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.