LITTLEBLACKDOG.COM Forum Index LITTLEBLACKDOG.COM

 
LWD LWD   FAQ FAQ   Memberlist Memberlist   Usergroups Usergroups   Active Topics Active Topics   Register Register  
  Profile Profile   Log in to check your private messages Log in to check your private messages   Log in Log in  
  Who is Online Who is Online   Image Gallery Image Gallery   Chat Chat   Search Search  
  LWDGear       LBDGear  

View next topic
View previous topic
Post new topic     Reply to topic   LITTLEBLACKDOG.COM Forum Index » Code Warriors
Author Message
GibsonSG
Big Dog
Big Dog


Joined: 26 Aug 2003
Age: 29
Posts: 3071
Location: Lubbock, TX

Post Posted: Wed Apr 29, 2009 12:52 pm   Post subject: Emailing the results from a SQL Database Search Reply with quote Back to top  

Ok, this is gonna be long and drawn out, kudos to anybody who gets through it.

My company uses a list of contractors on various projects. They wanted me to enter said contractor info into a DB so that rather than print out a list and circle the ones they want bid packets sent out to, they can search by type and then check off the ones they want and have that list emailed to our secretary so she can fax stuff over to them.

So, we have a company intranet site that runs on Joomla and MySQL. I purchased an addin for it awhile back to use on another project called DBQuery that I'm using to do this stuff with.

So, here's what I have... they can click on a link and it takes them to a page where they can add contractors, or search for existing ones. When they search for an existing contractor it packages the results up all nice and proper like so:



Now, DBQ has a bunch of nifty things that you can do with variables and that is how I got the checkboxes in there. They use a variable that is tied to the record ID of each entry so that they're all unique.

So what I need to figure out is how to add a submit button to that results page and have it email all the info associated with each record that has a checkmark beside it.

So, I'm thinking I need to modify the template that is used to display the results. Now the checkboxes... it doesn't need to write anything to the the DB or save that info in any way after the submit is done. The list of contractors is going to be unique for each project. So all I need it to do is detect which ones have check marks next to them, and then send out an email with all associated info.

This is the code from the results template file:

Code: Select all

<?php
/***************************************
 *
 * @package Database Query
 * @Copyright (C) Toby Patterson
 * @ All rights reserved
 * @ DBQuery is Free Software
 * @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html
 **/

defined('_VALID_MOS') or die(_LANG_TEMPLATE_NO_ACCESS);

$dbq =& $this;
$helper = DBQProfessionalExecuteViewHelper::getInstance();

// Use this to get the results directly
//$results = $dbq->queryGetResults();

// Load the Over Lib library, which DBQ Professional can use
mosCommonHTML::loadOverlib();

// Intialize the display, which will calculate rows and columns -- This is required !
$this->initializeDisplay();
$class         = $dbq->getConfigValue('CSS_CLASS');
$classHeader   =  $class.'HorizontalHeader';
$CSSid         = $class.'Table';

// Make filters
if ( $helper->gridUsesFilters() ) {
?>
<table id="DBQGridDisplay" align="center">
<tr>
<br/>
<div id="DBQFilterDisplayControlShow" class="DBQFilterDisplayControlBox" style="display: none; "><?php echo _LANG_TEMPLATE_FILTER_SHOW ?></div>
<td class="DBQGridDisplayCell">

<div id="DBQFilterControl" >
   <h3><?php echo _LANG_TEMPLATE_FILTER_CONTROLS ?></h3>
   <div id="DBQFilterDisplayControlHide" class="DBQFilterDisplayControlBox"><?php echo _LANG_TEMPLATE_FILTER_HIDE ?></div>
   <form onsubmit="return filter(this)">
<?php
// Get ready to cycle through the field variables looking for filters to create
$helper->resetFilterCounter();
while ( $filterName = $helper->nextFilter() ) {
   // Make the HTML for the filter
   $controlDivID   = $helper->getFilterNameOfDivContainer();
   $filterTitle   = $helper->getFilterTitle();
?>
   <div>
      <fieldset>
         <div align="left" class="<?php echo $controlDivID ?>"><?php echo $filterTitle ?></div>
         <div align="left" class="<?php echo $controlDivID ?>" id="<?php echo $controlDivID ?>-Control"></div>
         <div align="left" class="<?php echo $controlDivID ?>" id="<?php echo $controlDivID ?>-Text"></div>
      </fieldset>
   </div>
<?php }// end of while loop ?>
    <fieldset>
      <p><?php echo _LANG_TEMPLATE_SEARCH ?> <INPUT TYPE="text" NAME="textFilter" size="6">
      <INPUT TYPE="button" NAME="buttonText" Value="<?php echo _LANG_TEMPLATE_FILTER_GO ?>" onClick="filter(this.form)"></p>
    </fieldset>
    <fieldset>
      <p><?php echo _LANG_TEMPLATE_FILTER_RESET_ALL ?></p>
      <input type="button" value="<?php echo _LANG_TEMPLATE_FILTER_RESET ?>" onclick="resetControls(this.form)"></p>
    </fieldset>

   </form>
</div>


</td>

<td class="DBQGridDisplayCell">

<?php } // end of making filters ?>
   <div align="center">

      <div id="gridPaginationSlider"></div>
      <div id="gridPagination"></div>
   </div>
   <div id="gridContainer" align="center" >
      <table id="gridSource" align="center">
      <tbody>
<?php

// Print the headers
echo '<tr>';
while ( $this->nextHeader() ) {
   $tooltip   = $helper->makeToolTip();
   $type      = $helper->getZpGridColumnType();
   $width      = $helper->getWidth();
   
   // Build width html
   $widthhtml = $width ? " width=\"$width\" " : '';
   
   echo "<th $tooltip class=\"$type $classHeader\" $widthhtml >".$this->header().'</th>';
}
echo "</tr>\n";

// Print the rows
while ( $this->nextRow() ) {
   echo '<tr>';
   while ( $this->nextColumn() )
      echo '<td>'.$this->field().'</td>';
   echo "</tr>\n";
}
?>
      </tbody>
      </table>
   </div>
   <div align="center" id="DBQRowControl">
      <?php echo $helper->printDBQGridPagination(); ?>
   </div>
   
<?php
if ( $helper->gridUsesFilters() ) {
   // Closing table elements, if filters are used
?>
</td>
</tr>
</table>
<?php

}
// ZpGrid Info

$helper->initializeZpGrid();
$pagination = $helper->getZpGridPaginationType();

if ( $helper->gridUsesFilters() ) {
?>
<script type='text/javascript'>

var filterDisplay = true;

// Assign an event to the div
document.getElementById('DBQFilterDisplayControlShow').onclick = function () {
      filterWindow = document.getElementById('DBQFilterControl').style.display = '';
      filterWindow = document.getElementById('DBQFilterDisplayControlShow').style.display = 'none';
      filterWindow = document.getElementById('DBQFilterDisplayControlHide').style.display = '';
   };
document.getElementById('DBQFilterDisplayControlHide').onclick = function () {
      filterWindow = document.getElementById('DBQFilterControl').style.display = 'none';
      filterWindow = document.getElementById('DBQFilterDisplayControlShow').style.display = '';
      filterWindow = document.getElementById('DBQFilterDisplayControlHide').style.display = 'none';
   };
</script>
<?php
}
?>


So can anybody tell me how I would go about adding a submit button to that, and how to make it detect which boxes have a checkmark, and then email that info?

I'm not so good with PHP and I've just gotten by so far based on DBQuery handling most of the work for me. Smile

_________________
This pan will kill your whole family, dig them up and eat them, and then vomit them back into their graves! Ctrl-Alt-Del
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic     Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
phpBB SEO
All times are GMT - 8 Hours

Help us keep advertisements off this site. Donate today!