Jump to content

Recommended Posts

i have a page where i display a list of records each with a hyperlink called 'delete'. when this delete hyperlink is clicked, a javascript funtion is called to throw a confirmation box(with OK and cancel buttons). when i say OK on the current page should reload with the other remaining records in the list (minus the record chosen to be delted).

 

how it works now:

 

page first loads blank. i click on search button to load the page(POST) with the list of records. then i choose one of them(by clicking on the delete hyperlink). confirmation box comes up, i click OK. it reloads the page - but it is blank. it does not show the page with the remainder of the records from the list.

 

there is also another function on this page that uses the GET method. if there are more than 25 records on the page, i display them on the next page. so, if i click on page # 2 at the bottom, the GET method starts working and the page is (re)loaded with the next 25 records.

 

here is the code if it can help!

 

<?PHP

//File for database information

require_once ("../config.php");

include ("phpInclude/cookie.php");


if ($select=$_POST["select"])
{
$select1=$_POST["select1"];
$select=$_POST["select"];

print ("SELECT1 is...: ".$select1);
print ("SELECT is...: ".$select);

$m1=$_POST["m1"];
$d1=$_POST["d1"];
$y1=$_POST["y1"];
$m2=$_POST["m2"];
$d2=$_POST["d2"];
$y2=$_POST["y2"];

$searchon=$_POST["searchon"];
}
elseif ($select=$_GET["select"])
{
$rowNum=$_GET["rowNum"];
$select=$_GET["select"];
$select1=$_GET["select1"];
print("SELECT IS...: ".$select);

$m1=$_GET["m1"];
$d1=$_GET["d1"];
$y1=$_GET["y1"];
$m2=$_GET["m2"];
$d2=$_GET["d2"];
$y2=$_GET["y2"];
}

$batch_ID=$_GET["batch_ID"];
//print("BATCH ID IS...: ".$batch_ID);

if (isset($USER_NAME))
{

	list($user_fname, $user_lname) = explode (' ', $USER_NAME);
	if ($USER_NAME == ' Office Manager')
	{
		$query= "SELECT grp_name FROM group_details";
	}
	else
	{
		$query= "SELECT grp_name FROM group_details, user_mgr WHERE user_mgr.user_fname='$user_fname' AND user_mgr.user_lname='$user_lname' AND user_mgr.user_grp_id=group_details.grp_id";
	}
	$result=mysql_query($query);

	$row = mysql_fetch_array($result);

	$group_name = $row["grp_name"];

}

?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>

<head>

<title>BILLING</title>

<link rel='stylesheet' type='text/css' href='css/styleSheet.css'>

<SCRIPT language="JavaScript" src="js/tree.js">

</SCRIPT>

<SCRIPT language="JavaScript">

<?PHP

//Navigation File
require_once ("../nav.php");

?>

</SCRIPT>



<SCRIPT language="JavaScript">

function trim(inputString) 
{

   // Removes leading and trailing spaces from the passed string. Also
   // removes consecutive spaces and replaces it with one space.

   var retValue = inputString;
   var ch = retValue.substring(0, 1);

   while (ch == " ") { // Check for spaces at the beginning of the string

      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);

   }

   ch = retValue.substring(retValue.length-1, retValue.length);

   while (ch == " ") { // Check for spaces at the end of the string

      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);

   }

   while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string

      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings

   }

   return retValue; // Return the trimmed string back to the user

} // Ends the "trim" function


function validate()
{

 	var err_msg = new Array();
	var i=0;
	var j=0;
	var bigstring = "Please correct the following errors:\n";
	var loginID = "";
	var pass = "";
	var count = 0;
	var aMatch = false;
	var aBlank = false;

	if (trim(y1).length < 1)
	{

		if ((m1.length < 1) || (d1.length < 1))
		{

		 err_msg[i] = "Invalid Date.";

		 i++;

		 }

	}

	if (trim(y2).length < 1)
	{

		if ((m2.length <0) || (d2.length <1))
		{

		 err_msg[i] = "Invalid Date.";

		 i++;

		 }

	}

	if (i>0)
	{

		for (j=0; j<err_msg.length; j++) {

			count = j + 1;

			bigstring = bigstring + "\n" + count +". " + err_msg[j];

		}

		alert (bigstring);



		return false;

	}
	else
	{

		return true;

	}

}



</SCRIPT>

<script>

function deleteReport()
{

	//alert("HERE IN FUNCTION");
	var answer= confirm("Warning: You are about to \'Detele\' a Final Billing Report.\r\nDeleting this report will return ALL of the encounters on that report to the billable encounter pool.\r\nThey are then eligible to be committed to another FINAL Billing Report or to be rendered \'Not Billable\'.\r\n\nIf you wish to Delete this Final Report, click \'OK\'. If you do not want to delete this report, click \'Cancel\' below.");
	//echo("var answer = confirm('Please note that you are generating a Final billing Report that contains temporary Pt. #\'s. If you wish to proceed, click \'OK\' below. If you wish to go back to Registered Patients and convert to permanent Pt. #\'s, click the \'Back\' button below. ');");
	alert(answer);
	if (answer) return(true);
	else return (false);

}
</script>
<?

if (isset($batch_ID))
{

	//print("BATCH ID IS...: ".$batch_ID);
	//print("Here in update");
	$updatequery="UPDATE dcn SET dcn_posted_for_billing='No', dcn_billing_batch_ID='' WHERE dcn_billing_batch_ID='$batch_ID'";
	print $updatequery;
	$resultupdatequery=mysql_query($updatequery);
	if (! $resultupdatequery)
	{
		 $error="Error updating dcn";
	}

	//print("Here in delete");
	$deletequery="DELETE FROM billing_batch WHERE batch_ID='$batch_ID'";
	$resultdeletequery=mysql_query($deletequery);
	if (! $resultdeletequery)
	{
		 $error="Error deleting from billing_batch";
	}


}

?>

</head>



<BODY onload="window.scroll(0,yoffset)">

<table width="900" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td colspan="4" bgcolor="#FFFFFF">
      <div align="left"><font color="#FFFFFF"></font></div>
      <div align="right"><font color="#FFFFFF"><img src="images/title_barom.jpg" width="900" height="69"></font></div></td>
  </tr>
  <tr>
    <td align="left" valign="top" width="276" height="571">
      <table width="276" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td align="left" valign="top"><div align="center"><img src="../images/clear.gif" height="15" width="1"><font color="#006699"><img src="images/clear.gif" height="15" width="1"><b><?PHP print($group_name); ?><br>
              User: </b><?PHP print($USER_NAME); ?> </font></div></td>
        </tr>
        <tr>
          <td align="left" valign="top"> <SCRIPT language="JavaScript">

   tree.loadState()

   tree.display()

</SCRIPT> </td>
        </tr>
      </table>


<p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><? print("<b>$copyright1</b>"); ?></p>
</td>
    <td colspan="3" align="left" valign="top" width="624" height="571"> <br> <br>
      <table width="614" border="1" cellspacing="0" cellpadding="0" align="center" bordercolor="#006699">
        <tr>
          <td bgcolor="#006699"> <b><font color="#FFFFFF">PREVIOUS REPORTS</font></b>
          </td>
        </tr>
        <tr>
          <td height="472"> <table width="592" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td colspan="3"><img src="../images/clear.gif" width="1" height="15"></td>
              </tr>
              <tr>
                <td width="15"> </td>
                <td rowspan="3" align="left" valign="top" width="563"> <form action="previousPostingBatches.php" method="post" name="form1" id="form1" onSubmit="return validate()">
                    <!--**********Begin Search Parameters table (before Search button) **********-->
                    <table width="564" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="297"> <div align="right"><font class="inputLbl">
                            <input type="hidden" name="select" value="<? print ("ICN"); ?>">
                            </font></div></td>
                        <td colspan="2"> </td>
                      </tr>
                      <tr>
                        <td width="297"> <div align="right">
                            <div align="right"><font class="inputLbl">From Date:     </font></div>
                          </div></td>
                        <td width="267" colspan="2"> <input class="txtboxsm" type="text" name="m2" maxlength="2" value="<? if (isset($m2)){ print ("$m2"); }?>" >
                          /
                          <input class="txtboxsm" type="text" name="d2" maxlength="2" value="<? if (isset($d2)){ print ("$d2"); }?>" >
                          /
                          <input class="txtboxsm" type="text" name="y2" maxlength="4" value="<? if (isset($y2)){ print ("$y2"); }?>" >
                        </td>
                      </tr>
                      <tr>
                        <td width="297"> <div align="right">
                            <div align="right"><font class="inputLbl">To Date:     </font></div>
                          </div></td>
                        <td width="267" colspan="2"> <input class="txtboxsm" type="text" name="m1" maxlength="2" value="<? if (isset($m1)){ print ("$m1"); }?>" >
                          /
                          <input class="txtboxsm" type="text" name="d1" maxlength="2" value="<? if (isset($d1)){ print ("$d1"); }?>" >
                          /
                          <input class="txtboxsm" type="text" name="y1" maxlength="4" value="<? if (isset($y1)){ print ("$y1"); }?>" >
					 <script language="JavaScript"></script>


                        </td>
                      </tr>
                      <tr>
                        <td width="297"> <div align="right"><font class="inputLbl">Display
                            Results In:    </font></div></td>
                        <td width="267" colspan="2"><font class ="SELECT">
                          <select name="select1">
                            <? if (isset ($select1)){

						print ("<option value='$select1' selected>");

						  if($select1==DESC){print "Descending Order"; }

						  elseif ($select1==ASC){print "Ascending Order"; }

						print ("</option>");



						if ($select1 != 'DESC'){ print ("<option value='DESC'>Descending Order</option>"); }

						if ($select1 != 'ASC') { print ("<option value='ASC'>Ascending Order</option>"); }

						}

						else {

						?>
                            <option value="DESC" >Descending Order</option>
                            <option value="ASC">Ascending Order</option>
                          </select>
                          <? } ?>
                          </font></td>
                      </tr>
                      <tr>
                        <td width="297"> <div align="right"></div></td>
                        <td width="267" colspan="2">
                        
                        <input name="searchon" type="hidden" id="searchon" value="Yes">
                        <input class="sbttn"  type="submit" name="Submit" value="Search">
                        </td>
                      </tr>
                    </table> 
                  </form>
                  <table width="565" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td bgcolor="#006699"> <div align="left"><b><font color="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Batch ID
                          </font></font></b></div></td>
                      <td bgcolor="#006699"> <div align="center"><b><font color="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Date
                      	  Generated</font></font></b></div></td>
                      <td bgcolor="#006699"> <div align="center"><b><font color="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Time
                          Generated</font></font></b></div></td>
                      <td bgcolor="#006699"> <div align="center"><b><font color="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Generated
                          By</font></font></b></div></td>
                      <td bgcolor="#006699"> <div align="center"><b><font color="#FFFFFF"><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Delete
                          Rpt</font></font></b></div>
                        <div align="center"><b><font color="#FFFFFF"></font></b></div></td>
                    </tr>

                    <?PHP

					if ($select)
					{

							if (empty($m1)&& empty($d1) && empty ($y1))

						{

							$query3="select Date_Format(curdate(), '%Y/%m/%d/') as dates";

							$resultz=mysql_db_query("$database[dbname]", $query3);

							$rz=mysql_fetch_array($resultz);

							$dates=$rz["dates"];

						 }

						else

						{

							$dates=trim("$y1")."/".trim("$m1")."/".trim("$d1");



						}





						if (empty($m2)&& empty($d2) && empty ($y2))

						{

							$datez="";

						}

						else

						{

							$datez=trim("$y2")."/".trim("$m2")."/".trim("$d2");



						}

						print("HERE AFTER DEKETE");


						$query2="SELECT batch_ID, Date_Format(batch_date_created, '%m/%d/%Y') as batch_date_created, Time_Format(batch_time_created, '%h:%i %p') as batch_time_created, batch_created_by
								 FROM billing_batch
								 WHERE batch_date_created <= '$dates' AND batch_date_created >= '$datez'
								 ORDER BY  batch_ID $select1";
								 //print($query2);


						$result=mysql_db_query("$database[dbname]", $query2);

						$num_rows=mysql_num_rows($result);

						$num_results=mysql_num_rows($result);
						$row2 = mysql_fetch_array($result);
						$batch_ID=$row2["batch_ID"];
						$batch_created_dt=$row2["batch_date_created"];
						$batch_created_tm=$row2["batch_time_created"];
						$batch_created_by=$row2["batch_created_by"];
						//print("BATCH ID IS ...: ".$batch_ID);
						$i=1;



						if(!isset($rowNum))

						{

							$rowNum = 0;

						}



						$rowNumHold = $rowNum;
						//echo "$rowNum";



						$count = 1;

						$limit_results = 25;



						if ($num_rows > 0)

						{

							for($q=0;$q<$limit_results && $rowNum < $num_rows;$q++)

							{

								if(mysql_data_seek($result, $rowNum++))

								{

									if ($i++%2)

									{

										print ("<tr  bgcolor=\"#cccccc\">");

									}

									else

									{

										print ("<tr>");

									}





									$row = mysql_fetch_object($result);

									print("<td height=\"14\"> <div align=\"left\">");

									print($row->batch_ID);

									print("</div></td>");


									print("<td height=\"14\"> <div align=\"center\">");

									//print($row->batch_date_created);
									print ("<a href=\"billingPostCard1.php?batch_ID=$row->batch_ID\">$row->batch_date_created</a>");

									print("</div></td>");

									print("<td height=\"14\"> <div align=\"center\">");

									print($row->batch_time_created); print(" "); print("$servertimezone");

									print("</div></td>");

									print("<td height=\"14\"> <div align=\"center\">");

									print($row->batch_created_by);

									print("</div></td>");

									print("<td height=\"14\"> <div align=\"center\">");
									//print ("<a href=\"billingPostCard1.php?batch_ID=$row->batch_ID\">Select</a>");
									print ("<a href=\"previousPostingBatches.php?batch_ID=$row->batch_ID\" onClick=\"return deleteReport()\">Delete</a>");
									//print ("<a href=\"previousPostingBatches.php?batch_ID=$row->batch_ID\" onClick=\"return confirm('Warning: You are about to \'Detele\' a Final Billing Report.\r\nDeleting this report will return ALL of the encounters on that report to the billable encounter pool.\r\nThey are then eligible to be committed to another FINAL Billing Report or to be rendered \'Not Billable\'.\r\n\nIf you wish to Delete this Final Report, click \'OK\'. If you do not want to delete this report, click \'Cancel\' below.')\">Delete</a>");

									print("</div></td>");

									print("</tr>");

								}

							}



							print ("<tr>");

							print("<td colspan=\"6\" height=\"14\"> <div align=\"center\">");



							$pages = intval($num_rows/$limit_results);

							if($num_rows%$limit_results)

							{

								$pages++;

							}


							print("<br>");

							print("<b>Page</b> ");

							for($z=0;$z<$pages;$z++)

							{

								print("<a href=\"previousPostingBatches.php?rowNum=");

								print ($limit_results*$z);

								print("&select=");

								print($select);

								print("&select1=");

								print($select1);

								print("&m1=");

								print($m1);

								print("&m2=");

								print($m2);

								print("&y1=");

								print($y1);

								print("&y2=");

								print($y2);

								print("&d1=");

								print($d1);

								print("&d2=");

								print($d2);

								print("\">");

								if(($z + 1) == (($rowNumHold/$limit_results) + 1))

								{

									print("[");

									print($z + 1);

									print("]");

								}

								else

								{

									print($z + 1);

								}



								print("</a> ");

							}


							print(" ($num_rows records found)");



							print("</div></td>");

							print("</tr>");

						}

						else

						{

					?>
						<tr>
						  <td height="14" bgcolor="#CCCCCC"> </td>
						  <td height="14" bgcolor="#CCCCCC">No Posting Card Batches Found ...</td>
						  <td height="14" bgcolor="#CCCCCC"> </td>
						  <td height="14" bgcolor="#CCCCCC"> </td>

						</tr>
					 <?PHP

						}
					}

				?>
                  </table></td>
              <tr>
                <td width="15" height="431"><img src="../images/clear.gif" width="15" height="8"></td>
                <!--<td width="15" height="431"> </td>-->
              </tr>

            </table></td>
        </tr>

		<table width="564" border="0" cellspacing="0" cellpadding="0">
		   <br>
			<tr>
			  <td width="252"> <div align="left"> </div></td>
			  <td colspan="3">

				<form action="billingPrintlists.php?type=billingbatch" method="post" name="form1" id="form">
				  <input name="y2" type="hidden" id="y2" value="<? print("$y2"); ?>">
				  <input name="d2" type="hidden" id="d2" value="<? print ("$d2"); ?>">
				  <input name="m2" type="hidden" id="m2" value="<? print ("$m2"); ?>">
				  <input name="y1" type="hidden" id="y1" value="<? print("$y1"); ?>">
				  <input name="d1" type="hidden" id="d1" value="<? print("$d1"); ?>">
				  <input name="m1" type="hidden" id="m1" value="<? print ("$m1"); ?>">
				  <input name="select" type="hidden" id="select" value="<? print("$select"); ?>">
				  <input name="select1" type="hidden" id="select1" value="<? print("$select1"); ?>">

				  <?

					if (($searchon == "Yes") OR (isset($_GET["rowNum"])))
					{
				  ?>
				  <input class="sbttn" type="submit" name="Submit2" value="Print-Friendly">
				  <?
				  }
				 ?>

				</form>
			  </td>
			</tr>

		</table>
      </table>
  </tr>
</table>





</body>

</html>

<?PHP

mysql_close();

?>

 

 

how do i make the third action on this screen work the way i want it to?

any help will be great. thanx

Link to comment
https://forums.phpfreaks.com/topic/75264-solved-help-with-get/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.