Jump to content

[SOLVED] A little PHP/JS help


GreenSmurf

Recommended Posts

Is there any way to make these two forms not conflict? I want both of them to interact with each other. Meaning I want the user to be able to select the group to be displayed from the DB and the number of items per page but each time an option is changed it wipes all information and only loads either the new limit or the new group.

 

<form>
<select name="limit" onChange="this.parentNode.submit()">
<option value="<?php echo $limit; ?>" selected><?php echo $limit;  ?></option>
<option value="15">15</option>
<option value="35">35</option>
<option value="55">55</option>
<option value="75">75</option>
<option value="95">95</option>
<option value="<? echo $nume; ?>">All</option>
</select>
</form>
</td>
<td width=10% align=right>
<form>
<select name="group" onChange="this.parentNode.submit()">
<?
if($group_name != "") 
{
	echo "<option>$group_name</option>\n";
}
?>
<option value="">[all]</option>
<option value="[none]">[none]</option>
<?
$sql="SELECT group_name FROM $table_groups ORDER BY lower(group_name) ASC";
$result_groups = mysql_query($sql);
$result_gropup_snumber = mysql_numrows($result_groups);

while ($myrow = mysql_fetch_array($result_groups))
{
	echo "<option>".$myrow["group_name"]."</option>\n";
}
?>
</select>
</form>

 

-Brandon

Link to comment
https://forums.phpfreaks.com/topic/111557-solved-a-little-phpjs-help/
Share on other sites

Thank you for your previous response. I Took your advise but I am now stuck on a different problem. It seems to not be submitting the information from the forms at all. Any suggestions on what to change?

 

  <form action="index<? echo $page_ext; ?>" method="post">
      <select name="limit">
        <option value="<?php echo $limit; ?>" selected><?php echo $limit;  ?></option>
        <option value="15">15</option>
        <option value="35">35</option>
        <option value="55">55</option>
        <option value="75">75</option>
        <option value="95">95</option>
        <option value="<? echo $nume; ?>">All</option>
      </select>
</td>
<td width=10% align=right>
      <select name="group">
        <?
      if($group_name != "")
          {
      	echo "<option>$group_name</option>\n";
       }
       ?>
         <option value="">[all]</option>
         <option value="[none]">[none]</option>
       <?
       	$sql="SELECT group_name FROM $table_groups ORDER BY lower(group_name) ASC";
    $result_groups = mysql_query($sql);
    $result_gropup_snumber = mysql_numrows($result_groups);

  	    while ($myrow = mysql_fetch_array($result_groups))
       	{
    	echo "<option>".$myrow["group_name"]."</option>\n";
     }
      ?>
     </select>
</td>
<td width="1">
<input type="Submit" name="change" value="Update Page">
</td>
</form>

 

-Brandon

Solved the last problem but-

 <form action="reports<? echo $page_ext; ?>" method="post">
     <select name="limit">
       <option value="<?php echo $limit; ?>" selected><?php echo $limit;  ?></option>
       <option value="15">15</option>
       <option value="35">35</option>
       <option value="55">55</option>
       <option value="75">75</option>
       <option value="95">95</option>
       <option value="<? echo $nume; ?>">All</option>
     </select>
</td>
<td width=10% align=right>
     <select name="group_name">
       <?
      if($group_name != "")
         {
      	echo "<option>$group_name</option>\n";
       }
      ?>
        <option value="">[all]</option>
        <option value="[none]">[none]</option>
      <?
      	$sql="SELECT group_name FROM $table_groups ORDER BY lower(group_name) ASC";
    $result_groups = mysql_query($sql);
    $result_gropup_snumber = mysql_numrows($result_groups);

 	    while ($myrow = mysql_fetch_array($result_groups))
      	{
    	echo "<option>".$myrow["group_name"]."</option>\n";
     }
     ?>
    </select>
</td>
<td width="1">
<input type="Submit" name="submit" value="Update Page">
</td>
</form>

$nume is the total number of results without limits in the query but the only problem is that as of right now it is always loading the $nume from the previous result because it is gathered after the query has been run for the current page and loads on the next; is there a way to get it to load the total results for the next page depending on if the group changes intsead of the previous page? Thank you in advanced.

 

-Brandon

 

 

 <form action="reports<? echo $page_ext; ?>" method="post">
      <select name="limit">
        <option value="<?php echo $limit; ?>" selected><?php echo $limit;  ?></option>
        <option value="15">15</option>
        <option value="35">35</option>
        <option value="55">55</option>
        <option value="75">75</option>
        <option value="95">95</option>
        <option value="<? echo $nume; ?>">All</option>
      </select>
</td>

Still trying to get $nume to get the NEW value of the total number of rows for the next page as opposed to the total number of the current. Any ideas?

 

-Brandon

 

 

Where do you set the value of $nume? You aren't showing that part of the code.

 

This is an example query that would affect $result2:

$query2="SELECT * FROM $base_from_where ".$sort.";";

 

This is where $nume gets set:

$result2=mysql_query($query2);
$nume=mysql_num_rows($result2);

 

Both are set before the dropdown box portion of the code.

 

I have been experimenting on getting it to get the value of the new query being sent to the new page but it still loads the old information from the previous page. Any suggestions would be great. Thank you for your time.

 

-Brandon

Are you limiting the results? If so, you are always going to get the limited number back. Try adding a count to the query, something like:

$query2="SELECT *, (SELECT COUNT(something) FROM theSameTable) as total FROM $base_from_where ".$sort.";";

 

If that isn't the problem then I really don't understand what you are trying to do. If you get the total from the query, then why do you need the total in the form? And how can you expect to know the total of the next query before it is executed?

Are you limiting the results? If so, you are always going to get the limited number back. Try adding a count to the query, something like:

$query2="SELECT *, (SELECT COUNT(something) FROM theSameTable) as total FROM $base_from_where ".$sort.";";

 

If that isn't the problem then I really don't understand what you are trying to do. If you get the total from the query, then why do you need the total in the form? And how can you expect to know the total of the next query before it is executed?

 

I am limiting the results but not through $query2. I am limiting the results by $sql. $query2 is run to get the total number of rows from the queries being sent without limitations thus giving me the number I need to display all but when all is selected the previous value of $nume is being sent because $limit is set by $_REQUEST["limit"] and this is in turn set by the 'All' selection in the dropdown menu.

 

Does that make any sense?

 

-Brandon

Basically if anyone know a way to get display all to work in PHP from a dropdown menu I would greatly apperciate some advice. I can even supply the whole bit of code. I have been avoiding posting it because its a bit lengthy. Thank you to anyone willing to help.

 

-Brandon

Here is the complete working code:

<?
 include ("include/dbconnect.php");
 include ("include/format.inc.php");
 ?><title>Address book <? echo ($group_name != "" ? "($group_name)":""); ?></title><?
 include ("include/header.inc.php");
 $page_name="reports.php"; // If you use this code with a different page ( or file ) name then change this
?>
<!--
 You need to finished the header statement. Finish the links and begin editing the sort/order function. Aslo, remember to change the
 searchstring.
-->
 <br><br>
<center>
 <table border-bottom=1 cellspacing="2">
 <col align=left></col>
 <col width=10></col>
 <col valign=bottom align=left></col>
 <col valign=bottom align=left></col>
 <col valign=bottom align=left></col>
 <col valign=bottom align=left></col>
 <col valign=bottom align=left></col>
 <form method="POST" action="<? $PHP_SELF ?>">
   <tr valign=center>
     <td><strong>Quickbooks Services: </strong></td>
     <td> </td>
  <td>
        <input type="radio" name="qb" value="qbsup" <?php if($_REQUEST['qb']=="qbsup"){echo "checked";} ?>> QB Supplied to Accountant</td>
     <td>
         <input type="radio" name="qb" value="qbent" <?php if($_REQUEST['qb']=="qbent"){echo "checked";} ?>> QB Data Entry by Accountant</td>
     <td>
        <input type="radio" name="qb" value="qbtran" <?php if($_REQUEST['qb']=="qbtran"){echo "checked";} ?>> QB Training</td>
     <td>
        <input type="radio" name="qb" value="cs" <?php if($_REQUEST['qb']=="cs"){echo "checked";} ?>> Creative Solutions</td>
     <td>
        <input type="radio" name="qb" value="tr" <?php if($_REQUEST['qb']=="tr"){echo "checked";} ?>> Tax Return</td></tr>
  <tr>
      <td> </td>
      <td> </td>
      <td>
        <input type="radio" name="qb" value="qbnone" <?php if($_REQUEST['qb']=="qbnone" OR $_REQUEST['qb']==""){echo "checked";} ?>> None</td>
      <td>
        <input type="radio" name="qb" value="nonqb" <?php if($_REQUEST['qb']=="nonqb"){echo "checked";} ?>> Non QB Client</td></tr>
        <tr><td/></tr>
        <tr><td/></tr>
   <tr valign=center>
     <td><strong>Business Type: </strong></td>
     <td> </td>
  <td>
        <input type="radio" name="bus" value="personal" <?php if($_REQUEST['bus']=="personal"){echo "checked";} ?>>Personal</td>
     <td>
        <input type="radio" name="bus" value="ccorp" <?php if($_REQUEST['bus']=="ccorp"){echo "checked";} ?>>C Corporation</td>
     <td>
        <input type="radio" name="bus" value="partner" <?php if($_REQUEST['bus']=="partner"){echo "checked";} ?>>Partnership, LLC</td>
     <td>
        <input type="radio" name="bus" value="scorp" <?php if($_REQUEST['bus']=="scorp"){echo "checked";} ?>>S Corporation</td>
     <td>
        <input type="radio" name="bus" value="estate" <?php if($_REQUEST['bus']=="estate"){echo "checked";} ?>>Estate & Trust</td>
  </tr>
  <tr valign=center>
     <td> </td>
     <td> </td>
     <td>
        <input type="radio" name="bus" value="non" <?php if($_REQUEST['bus']=="non"){echo "checked";} ?>> Non-Profit</td>
     <td>
        <input type="radio" name="bus" value="sole" <?php  if($_REQUEST['bus']=="sole"){echo "checked";} ?>> Sole Proprietor</td>
     <td>
        <input type="radio" name="bus" value="single" <?php  if($_REQUEST['bus']=="single"){echo "checked";} ?>> Single Member LLC</td>
        <td> </td>
        <td> </td></tr>
     <tr>
       <td> </td>
       <td> </td>
       <td>
        <input type="radio" name="bus" value="busnone" <?php if($_REQUEST['bus']=="busnone" OR $_REQUEST['bus']==""){echo "checked";} ?>> None</td></tr>
        <tr><td/></tr>
        <tr><td/></tr>
  <tr valign=center>
     <td><strong>Financial Statements: </strong></td>
     <td> </td>
  <td>
        <input type="radio" name="fin" value="month" <?php if($_REQUEST['fin']=="month"){echo "checked";} ?>> Monthly</td>
     <td>
        <input type="radio" name="fin" value="quart" <?php if($_REQUEST['fin']=="quart"){echo "checked";} ?>> Quarterly</td>
     <td>
        <input type="radio" name="fin" value="ann" <?php if($_REQUEST['fin']=="ann"){echo "checked";} ?>> Annually</td>
     <td> </td>
     <td> </td>
  </tr>
  <tr>
       <td> </td>
       <td> </td>
       <td>
        <input type="radio" name="fin" value="finnone" <?php if($_REQUEST['fin']=="finnone" OR $_REQUEST['fin']==""){echo "checked";} ?>> None</td>
        <td>
        <input type="radio" name="fin" value="nonfin" <?php if($_REQUEST['fin']=="nonfin"){echo "checked";} ?>> Non Financials Client</td></tr>
        <tr><td/></tr>
        <tr><td/></tr>
  <tr valign=center>
     <td><strong>Other: </strong></td>
     <td> </td>
  <td>
        <input type="radio" name="oth" value="tax" <?php if($_REQUEST['oth']=="tax"){echo "checked";} ?>> Sales Tax</td>
     <td>
        <input type="radio" name="oth" value="pay" <?php if($_REQUEST['oth']=="pay"){echo "checked";} ?>> Payroll</td>
     <td> </td>
     <td> </td>
     <td> </td>
  </tr>
  <tr>
       <td> </td>
       <td> </td>
       <td>
        <input type="radio" name="oth" value="othnone" <?php if($_REQUEST['oth']=="othnone" OR $_REQUEST['oth']==""){echo "checked";} ?>> None</td>
        <td>
        <input type="radio" name="oth" value="nonoth" <?php if($_REQUEST['oth']=="nonoth"){echo "checked";} ?>> Non Services Client</td></tr>
        <tr><td/></tr>
        <tr><td/></tr>
       <tr><td align=right colspan=7>
       <input type="submit" value="Search">
       <input type="hidden" name="limited" value="<? echo $_REQUEST["limited"]; ?>">
       <input type="hidden" name="group_name" value="<? echo $_REQUEST["group_name"]; ?>"></td></tr>
   <td> </td></tr>

 </form>
<?

if (($_REQUEST['qb']=="" AND $_REQUEST['bus']=="" AND
    $_REQUEST['oth']=="" AND $_REQUEST['fin']=="") OR
    ($_REQUEST['qb']=="qbnone" AND $_REQUEST['bus']=="busnone" AND
    $_REQUEST['oth']=="othnone" AND $_REQUEST['fin']=="finnone"))
      $searchstring= "";

if ($_REQUEST['qb']=="qbsup")
  $searchstring .= "qbserv = 'QB Supplied to Accountant'";
else if ($_REQUEST['qb']=="qbent")
  $searchstring .= "qbserv = 'QB Data Entry by Accountant'";
else if ($_REQUEST['qb']=="qbtran")
  $searchstring .= "qbserv = 'QB Training'";
else if ($_REQUEST['qb']=="cs")
  $searchstring .= "qbserv = 'Creative Solutions'";
else if ($_REQUEST['qb']=="tr")
  $searchstring .= "qbserv = 'Tax Return'";
else if ($_REQUEST['qb']=="nonqb")
  $searchstring .= "qbserv = ''";

if ($searchstring!="" AND ($_REQUEST['bus']!="" AND $_REQUEST['bus']!="busnone"))
  $searchstring =$searchstring." AND ";

if ($_REQUEST['bus']=="personal")
  $searchstring .= "bustype = 'Personal'";
else if ($_REQUEST['bus']=="ccorp")
  $searchstring .= "bustype = 'C Corporation'";
else if ($_REQUEST['bus']=="partner")
  $searchstring .= "bustype = 'Partnership, LLC'";
else if ($_REQUEST['bus']=="scorp")
  $searchstring .= "bustype = 'S Corp'";
else if ($_REQUEST['bus']=="estate")
  $searchstring .= "bustype = 'Estate & Trust'";
else if ($_REQUEST['bus']=="non")
  $searchstring .= "bustype = 'Non-Profit'";
else if ($_REQUEST['bus']=="sole")
  $searchstring .= "bustype = 'Sole Proprietor'";
else if ($_REQUEST['bus']=="single")
  $searchstring .= "bustype = 'Single Member LLC'";

if ($searchstring!="" AND ($_REQUEST['fin']!="" AND $_REQUEST['fin']!="finnone"))
  $searchstring =$searchstring." AND ";

if ($_REQUEST['fin']=="month")
  $searchstring .= "fstats = 'Monthly'";
else if ($_REQUEST['fin']=="quart")
  $searchstring .= "fstats = 'Quarterly'";
else if ($_REQUEST['fin']=="partner")
  $searchstring .= "fstats = 'Annually'";
else if ($_REQUEST['fin']=="nonfin")
  $searchstring .= "fstats = ''";

if ($searchstring!="" AND ($_REQUEST['oth']!="" AND $_REQUEST['oth']!="othnone"))
  $searchstring =$searchstring." AND ";

if ($_REQUEST['oth']=="tax")
  $searchstring .= "stax = 'on'";
else if ($_REQUEST['oth']=="pay")
  $searchstring .= "payroll = 'on'";
else if ($_REQUEST['oth']=="nonoth")
  $searchstring .= "payroll = '' AND stax = ''";

//echo $searchstring;
?>
<script type="text/javascript">
function MassSelection()
{
 for (i = 0; i < document.getElementsByName("selected[]").length; i++)
 {
    document.getElementsByName("selected[]")[i].checked = document.getElementById("MassCB").checked;
 }

 // location.href = "mailto:"+addresses;

}


function MailSelection()
{

 var addresses = "";
 var names = "";
 var business = "";
 var dst_count = 0;

 for (i = 0; i < document.getElementsByName("selected[]").length; i++)
 {
     if( document.getElementsByName("selected[]")[i].checked == true)
     {
        if( document.getElementsByName("selected[]")[i].accept != "")
        {
           addresses = addresses + document.getElementsByName("selected[]")[i].accept + ";";
           names = names + document.getElementsByName("selected[]")[i].names + ";";
           dst_count++;
           if( document.getElementsByName("selected[]")[i].buss != "")
               business = business + document.getElementsByName("selected[]")[i].buss + ";";
        }
     }
 }

  if(dst_count == 0)
      alert("No address selected.");
   else
       location.href = "mail.php?email="+addresses+"&names="+names+"&bus="+business;
}
</script>
<!--
<table width=100%><td valign=top style="border-top-width:2.5px;border-top-style:solid;border-top-color:#FFFFFF">
-->
<tr><td align=center colspan=7>
<?
//$grp = $_REQUEST["group"];
/*$sql="SELECT group_name FROM $table_groups ORDER BY lower(group_name) ASC";
$result_groups = mysql_query($sql);
$myrow = mysql_fetch_array($result_groups);*/
/*if ($grp == '' OR $grp == NULL){

  $grpDis = '';

}
else {

    $grpDis = 'group='.$grp.'&';
    //./?group=$group_name'

} */
$alpha = $_REQUEST["alphabet"];
//Alpha Check
if ($alpha != NULL OR $alpha != '')
  $alpha='alphabet='.$_REQUEST["alphabet"].'&';
//Group Check
if ($group_name != ""){
  $grp=ereg_replace(" ",'+',$group_name);
  $grpdis='group_name='.$grp.'&';
}
//Search Check
if ($searchstring != ""){
  if ($_REQUEST['qb']!="" AND $_REQUEST['qb']!="qbnone")
     $search = "qb=".$_REQUEST['qb']."&";
  if ($_REQUEST['fin']!="" AND $_REQUEST['fin']!="finnone")
     $search .= "fin=".$_REQUEST['fin']."&";
  if ($_REQUEST['oth']!="" AND $_REQUEST['oth']!="othnone")
     $search .= "oth=".$_REQUEST['oth']."&";
  if ($_REQUEST['bus']!="" AND $_REQUEST['bus']!="busnone")
     $search .= "bus=".$_REQUEST['bus']."&";
  if ($searchstring =="")
     $search="";
  
}
if ($_REQUEST["sort"]!= ''){
 $pSort = 'sort='.$_REQUEST["sort"].'&';
}
if ($_REQUEST["order"]!= ''){
 $pOrder = 'order='.$_REQUEST["order"].'&';
}
if ($limited!=0 AND $limited!=""){
  $limlam = 'limited='.$limited.'&';
}
$link = $page_name."?".$search.$stDis.$limlam.$grpdis."alphabet";
$link2 = $page_name."?".$grpdis.$alpha.$search.$stDis."";
//echo $start."||".$_REQUEST["start"]."<br><br>";
echo "<a style='font-size:85%' href='$link=a'>A</a> | <a style='font-size:85%' href='$link=b'>B</a> |
        <a style='font-size:85%' href='$link=c'>C</a> | <a style='font-size:85%' href='$link=d'>D</a> |
        <a style='font-size:85%' href='$link=e'>E</a> | <a style='font-size:85%' href='$link=f'>F</a> |
        <a style='font-size:85%' href='$link=g'>G</a> | <a style='font-size:85%' href='$link=h'>H</a> |
        <a style='font-size:85%' href='$link=i'>I</a> | <a style='font-size:85%' href='$link=j'>J</a> |
        <a style='font-size:85%' href='$link=k'>K</a> | <a style='font-size:85%' href='$link=l'>L</a> |
        <a style='font-size:85%' href='$link=m'>M</a> | <a style='font-size:85%' href='$link=n'>N</a> |
        <a style='font-size:85%' href='$link=o'>O</a> | <a style='font-size:85%' href='$link=p'>P</a> |
        <a style='font-size:85%' href='$link=q'>Q</a> | <a style='font-size:85%' href='$link=r'>R</a> |
        <a style='font-size:85%' href='$link=s'>S</a> | <a style='font-size:85%' href='$link=t'>T</a> |
        <a style='font-size:85%' href='$link=u'>U</a> | <a style='font-size:85%' href='$link=v'>V</a> |
        <a style='font-size:85%' href='$link=w'>W</a> | <a style='font-size:85%' href='$link=x'>X</a> |
        <a style='font-size:85%' href='$link=y'>Y</a> | <a style='font-size:85%' href='$link=z'>Z</a> |
        <a style='font-size:85%' href='".($group == '' || $group == '[none]' || $fixgroup ? "$link=''" : '?group='.$group)."'>All</a>";
?>
</td>
</table>
</center>
<br>
<hr>
<?

//Shorten String Function Just like it sounds
function ShortenText($text, $lim) {

       // Change to the number of characters you want to display
       $chars = $lim;

       $text = $text." ";
       $text = substr($text,0,$chars);
       $text = substr($text,0,strrpos($text,' '));
       $text = $text."...";

       return $text;

   }
//End Function
//Phone Function
function phone_number($sPhone)
{
 $sPhone = ereg_replace("[^0-9]",'',$sPhone);

 if(strlen($sPhone) != 10) return(False);
   $sArea = substr($sPhone,0,3);

 $sPrefix = substr($sPhone,3,3);
 $sNumber = substr($sPhone,6,4);
 $sPhone = "(".$sArea.")".$sPrefix."-".$sNumber;

 return($sPhone);
}
//End Function
//
//SORT!!!
//
$rSort = $_REQUEST["sort"];
if ($searchstring!="" AND $rSort==""){

$rsort = 'today, lastname, firstname, boss, lastname2, firstname2, clientID';

}
$rOrder = $_REQUEST["order"];
if ($rOrder == '' OR $rOrder=='ASC'){

  $rOrder = 'DESC';

}
else {

    $rOrder = 'ASC';

}

if ($rOrder!='' AND $rSort!='') {

  $sort = 'ORDER BY '.$rSort.' '.$rOrder;

}
else {

    $sort = 'ORDER BY today, lastname, firstname, boss';

}
//End Sort!
if ($searchstring AND $alphabet){
  $query2="SELECT * FROM $base_from_where AND LEFT(lastname,1) = '$alphabet'
  AND ($searchstring)".$sort.";";
}
else if ($searchstring){
    $query2="SELECT * FROM $base_from_where AND ($searchstring)".$sort.";";
}
else if ($alphabet){
    $query2="SELECT * FROM $base_from_where AND LEFT(lastname,1) = '$alphabet' ".$sort.";";
}
else{
    $query2="SELECT * FROM $base_from_where ".$sort.";";
}
$result2=mysql_query($query2);
$nume=mysql_num_rows($result2);

if(!($start > 0)) { // This variable is set to zero for the first page
 $start = 0;
}
$eu = ($start - 0);
if ($_REQUEST["limited"]=="0" OR $_REQUEST["limited"]==""){
  $limit = 35;
  $limitDis = "$limit";
}
else if ($_REQUEST["limited"]=="all"){
  $limit = $nume;
  $limitDis = "All";
}
else{
   $limit = $_REQUEST["limited"]; // No of records to be shown per page.
   $limitDis = "$limit";
}
$this2 = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;
//

if ($searchstring AND $alphabet){
$sql="SELECT * FROM $base_from_where AND LEFT(lastname,1) = '$alphabet'
   AND ($searchstring)".$sort." LIMIT $eu, $limit;";
}
else if ($searchstring){
    $sql="SELECT * FROM $base_from_where AND ($searchstring)".$sort." LIMIT $eu, $limit;";
}
else if ($alphabet){
       $sql = "SELECT * FROM $base_from_where AND LEFT(lastname,1) = '$alphabet' ".$sort." LIMIT $eu, $limit;";
}
else
{
       $sql="SELECT * FROM $base_from_where ".$sort." LIMIT $eu, $limit;";
       $query2="SELECT * FROM $base_from_where ".$sort.";";
}
//echo $sql;
$result = mysql_query($sql);
$resultsnumber = mysql_numrows($result);

echo "<TABLE BORDER=0 width=100%>";
echo "<td><strong>Number of results: $nume</td>";

?>
<td valign=top align=right>
<small>Display Per Page: </small>
</td><td width=1 align=right>
 <form action="reports<? echo $page_ext; ?>" method="post">
     <select name="limited">
       <option value="<?php echo $limited; ?>" selected><?php echo $limitDis;  ?></option>
       <option value="15">15</option>
       <option value="35">35</option>
       <option value="55">55</option>
       <option value="75">75</option>
       <option value="95">95</option>
       <option value="all">All</option>
     </select>
</td>
<?
if(isset($table_groups) and $table_groups != "" and !$is_fix_group)
{
?>
<td width=10% align=right>
     <select name="group_name">
       <?
      if($group_name != "")
         {
      	echo "<option>$group_name</option>\n";
       }
      ?>
        <option value="">[all]</option>
        <option value="[none]">[none]</option>
      <?
      	$sql="SELECT group_name FROM $table_groups ORDER BY lower(group_name) ASC";
    $result_groups = mysql_query($sql);
    $result_gropup_snumber = mysql_numrows($result_groups);

 	    while ($myrow = mysql_fetch_array($result_groups))
      	{
    	echo "<option>".$myrow["group_name"]."</option>\n";
     }
     ?>
    </select>
</td>
<td width="1">
<input type="hidden" name="alphabet" value="<? echo $_REQUEST["alphabet"]; ?>">
<input type="hidden" name="qb" value="<? echo $_REQUEST["qb"]; ?>">
<input type="hidden" name="bus" value="<? echo $_REQUEST["bus"]; ?>">
<input type="hidden" name="fin" value="<? echo $_REQUEST["fin"]; ?>">
<input type="hidden" name="oth" value="<? echo $_REQUEST["oth"]; ?>">
<input type="Submit" name="submit" value="Update Page">
</td>
</form>
</td></tr>
</table>
<?
}
?>
<form name=MainForm method="POST" action="group<? echo $page_ext; ?>">
<input type="hidden" name="group" value="<? echo $group; ?>">
<table width=100% border=0 cellpadding="6" align="center">
<col width=1*>
<col width=2*>
<col width=3*>
<col width=4*>
<col width=5*>
<col width=6*>
<col width=170>
<col width=300>
<tr padding="0" align="center">
             <td> </td>
             <td><a href=<?php echo $link2 ?>sort=clientID&order=<?php echo $rOrder ?>>Client ID</a></td>
             <td><a href=<?php echo $link2 ?>sort=lastname&order=<?php echo $rOrder ?>>Lastname</a></td>
             <td><a href=<?php echo $link2 ?>sort=firstname&order=<?php echo $rOrder ?>>Firstname</a></td>
             <td><a href=<?php echo $link2 ?>sort=boss&order=<?php echo $rOrder ?>>Company</a></td>
             <td><a href=<?php echo $link2 ?>sort=boss&order=<?php echo $rOrder ?>>Business type</td>
             <td><a href=<?php echo $link2 ?>sort=qbserv&order=<?php echo $rOrder ?>>Quickbooks Service</a></td>
             <!-- <td><a href=<?php echo $link2 ?>sort=status1&order=<?php echo $rOrder ?>>Personal Status</a></td>
             <td><a href=<?php echo $link2 ?>sort=status2&order=<?php echo $rOrder ?>>Business Status</a></td>
             <td><a href=<?php echo $link2 ?>sort=status3&order=<?php echo $rOrder ?>>Retainer Status</a></td> -->
             <td>Activity</td>
</tr>
<?
$alternate = "2"; 

include ("guess.inc");

while ($myrow = mysql_fetch_array($result))
{

	$clientID = $myrow["clientID"];
	$firstname = $myrow["firstname"];
	$id = $myrow["id"];
	$lastname = $myrow["lastname"];
	$boss = $myrow["boss"];

	//$email  = ($myrow["email"] != "" ? $myrow["email"] : ($myrow["email2"] != "" ? $myrow["email2"] : ""));
	$qbserv = $myrow["qbserv"];

	$today   = $myrow["today"];
	$status1 = $myrow["status1"];//personal
	$status2   = $myrow["status2"];//business
	$status4  = $myrow["status4"];//retainer
	$bustype  = $myrow["bustype"];
	$notes  = $myrow["notes"];

	// Phone order home->mobile->work
/*	$phone = ($myrow["home"] != "" ? $myrow["home"]
                                              : ($myrow["mobile"] != "" ? $myrow["mobile"]
                                                                        : $myrow["work"])); */
	/*$phone = str_replace("'", "",
                        str_replace('/', "", 
                        str_replace(" ", "", 
                        str_replace(".", "", $phone))));*/
                        
       $phone = phone_number($phone);

	if ($alternate == "1") { 
		$color = "#ffffff"; 
		$alternate = "2"; 
	} 
	else { 
		$color = "#efefef"; 
		$alternate = "1"; 
	}
	echo "<TR bgcolor=$color>";
       if ($myrow['firstname2'] != "" AND $myrow['email2'] == ""){
            $names=$myrow['firstname']."-".$myrow['lastname'].";".$myrow['firstname2']."-".$myrow['lastname2'];
            $emails=$myrow['email'].";".$myrow['email'];
            $biz=$myrow['boss'].";".$myrow['boss'];}
            
       else if ($myrow['firstname2'] != "" AND $myrow['email2'] != ""){
            $names=$myrow['firstname']."-".$myrow['lastname'].";".$myrow['firstname2']."-".$myrow['lastname2'];
            $emails=$myrow['email'].";".$myrow['email2'];
            $biz=$myrow['boss'].";".$myrow['boss'];}
            
       else if ($myrow['firstname2'] == "" AND $myrow['email2'] == ""){
            $names=$myrow['firstname']."-".$myrow['lastname'];
            $emails=$myrow['email'];
            $biz=$myrow['boss'];}
            
       else{
           $names=$myrow['firstname']."-".$myrow['lastname'].";".$myrow['firstname']."-".$myrow['lastname'];
           $emails=$myrow['email'].";".$myrow['email2'];
            $biz=$myrow['boss'].";".$myrow['boss'];}

	echo "<TD><input type=checkbox id=".$id." name='selected[]' value='$id' title='Select ($firstname $lastname)' alt='Select ($firstname $lastname)' buss=$biz names=$names accept=$emails></td>";

	echo "<td>$clientID</td>";
	echo "<TD>$lastname</td>";
	echo "<td>$firstname</td>";
	echo "<td>".ShortenText($boss, 20)."</td>";
       echo "<td>$bustype</td>";
	echo "<td>$qbserv</a></td>";
	/* echo "<td align=right>$status1</td>";
	echo "<td align=right>$status2</td>";
	echo "<td align=right>$status3</td>";   */
       echo "<td>".ShortenText($notes, 70)."</td>";
	echo "</TR>\n";
}

echo "<tr height=2/>";
echo "<TR >";
	echo "<TD><input type=checkbox id=MassCB onclick=\"MassSelection()\"></td><td><em><strong>Select all</strong></em></TD>";
echo "</TR>\n";
echo "<tr height=9/>";
echo "</TR></TABLE>";
 echo "<TABLE width=100%><TR>";
       echo "<td><input type=button value=\"Send e-Mail\" onclick=\"MailSelection()\"/></td>";

/*if(isset($table_groups) and $table_groups != "" and !$is_fix_group)
{

	// -- Remove from group --
	if($group_name != "" and $group_name != "[none]")
	{
        	echo "<td align=center><input type=submit name=remove value='Remove from \"$group_name\"'/></td>";
	} else
        	echo "<td align=center/>";

	// -- Add to a group --
       	echo "<td align=right><input type=submit name=add value='Add to group'/>-";
       	echo "<select name=to_group>";

	$sql="SELECT group_name FROM $table_groups ORDER BY lower(group_name) ASC";
	$result = mysql_query($sql);
	$resultsnumber = mysql_numrows($result);

	while ($myrow = mysql_fetch_array($result))
	{
		echo "<option>".$myrow["group_name"]."</option>\n";
	}
       	echo "</select>";

}          */
echo "</TR></form>";

// Show group footer
       if($group_name != "" and $group_myrow['group_footer'] != "")
       {  
           echo "<tr><td colspan=3><hr>";
           echo $group_myrow['group_footer'];
           echo "<hr></td></tr>";
       }
echo "</TABLE>";
//Start (Pagination) Check
$pageNum = $_REQUEST["start"];
//
if ($start != NULL OR $start != ''){
 if ($start > $nume){
    while($start>$nume)
    {
     $start=$start-$limit;
    }
 }
 $stDis='start='.$eu.'&';
}
$link3 = $page_name."?".$grpdis.$alpha.$search.$pSort.$pOrder.$limlam."";
 //Prev & Next Buttons
if ( $limit < $nume) {
echo "<table align='center' width='36%'><tr><td align='left' width='15%'>";
      if($back >=0) {
        print "<a class='nexprev' href=".$link3."start=".$back."><< PREV</a>";
      }
      echo "</td><td align=center width='70%'>";
      $i=0;
      $l=1;
      for($i=0;$i < $nume;$i=$i+$limit){
      if($i <> $eu){
            echo " <a class='pages' href=".$link3."start=".$i.">  $l </a>";
            if ($l%10==0)
               echo "<br>";
      }
      else { echo "<font class='nonpages'>  $l </font>";} /// Current page is not displayed as link and given font color red
      $l=$l+1;}
      echo "</td><td align='right' width='15%'>";
      if($this2 < $nume) {
               print "<a class='nexprev' href=".$link3."start=".$next.">NEXT >></a>";}
      echo "</td></tr></table>";
 }//End Prev & Next buttons

include("include/footer.inc.php");

?>

 

Solved the problem. Thanks to all who helped.

 

-Brandon

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.