Jump to content

function in php???


rsammy

Recommended Posts

i am working on a php module where in i have to set a flag to either YES or No. Based on this flag, I need to display the records from teh database on the next screen.

I have two flags in dcn table called:  dcn_approve_for_billing and dcn_posted for billing. both flags are defaulted to 'no' initially.

i have a page, billingMgt.php where I am displaying all records and also displaying the dcn_approved_for_billing flag. also on the record is a link that will enable me to expand the record and view the details(clicking on this link takes me to RecordDetails.php page). in this page, I have two buttons, Approve for Billing and Remove from Billing. these buttons are enabled or grayed out based on values of the two flags in the dcn table.

this is the code for enabling disabling buttons based on the flag values... it works fine:

<form name="fax" method="post" action="billingMgt.php" onSubmit="return validate()">
<div align="center">
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#666666">

<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

<p>
<input type="hidden" name="visit_id" value="<? print ("$visit_id"); ?>">
<input type="hidden" name="visit_type" value="<? print ("$visit_type"); ?>">
<input type="hidden" name="visit_time" value="<? print ("$visit_time"); ?>">
<input type="hidden" name="visit_status" value="<? print ("$visit_status"); ?>">
<input type="hidden" name="visit_loc" value="<? print ("$visit_loc"); ?>">
<input type="hidden" name="visit_loc" value="<? print ("$visit_room_no"); ?>">
<input type="hidden" name="pat_first_name" value="<? print ("$pat_first_name"); ?>">
<input type="hidden" name="pat_last_name" value="<? print ("$pat_last_name"); ?>">
<input type="hidden" name="pat_phy_id" value="<? print ("$pat_phy_id"); ?>">
<input type="hidden" name="phy_fname" value="<? print ("$phy_fname"); ?>">
<input type="hidden" name="phy_lname" value="<? print ("$phy_lname"); ?>">
<input type="hidden" name="pat_dob" value="<? print("$pat_dob"); ?>">
<input type="hidden" name="pat_ssn" value="<? print("$pat_ssn"); ?>">
<input type="hidden" name="pat_sex" value="<? print ("$pat_sex");  ?>">
<input type="hidden" name="enter_date" value="<? print ("$enter_date");  ?>">
<input type="hidden" name="activate_date" value="<? print ("$activate_date");  ?>">
<input type="hidden" name="visit_timestamp_received" value="<? print ("$visit_timestamp_received");  ?>">
<input type="hidden" name="visit_palm_db_id" value="<? print ("$visit_palm_db_id");  ?>">
<input type="hidden" name="username" value="<? print ("$USER_NAME");  ?>">
<input type="hidden" name="approved_for_billing" value="<? print ("$dcn_approved_for_billing");  ?>">
 
<?

if ($dcn_posted_for_billing =="Yes")
{
?>
<input name="action" type="submit" class="sbttn" value="Approve for Billing" disabled="disabled">

<?
}
else if ($dcn_approved_for_billing =="Yes")
{
?>
<input name="action" type="submit" class="sbttn" value="Approve for Billing" disabled="disabled">
<?

}
else
{
?>
<input class="sbttn" type="submit" name="action" value="Approve for Billing">
<?

}
?>

</p>
</div>
</form>

<form name="fax" method="post" action="billingMgt.php" onSubmit="return validate()">
<div align="center">
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#666666">

<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

<p>
<input type="hidden" name="visit_id" value="<? print ("$visit_id"); ?>">
<input type="hidden" name="visit_type" value="<? print ("$visit_type"); ?>">
<input type="hidden" name="visit_time" value="<? print ("$visit_time"); ?>">
<input type="hidden" name="visit_status" value="<? print ("$visit_status"); ?>">
<input type="hidden" name="visit_loc" value="<? print ("$visit_loc"); ?>">
<input type="hidden" name="visit_loc" value="<? print ("$visit_room_no"); ?>">
<input type="hidden" name="pat_first_name" value="<? print ("$pat_first_name"); ?>">
<input type="hidden" name="pat_last_name" value="<? print ("$pat_last_name"); ?>">
<input type="hidden" name="pat_phy_id" value="<? print ("$pat_phy_id"); ?>">
<input type="hidden" name="phy_fname" value="<? print ("$phy_fname"); ?>">
<input type="hidden" name="phy_lname" value="<? print ("$phy_lname"); ?>">
<input type="hidden" name="pat_dob" value="<? print("$pat_dob"); ?>">
<input type="hidden" name="pat_ssn" value="<? print("$pat_ssn"); ?>">
<input type="hidden" name="pat_sex" value="<? print ("$pat_sex");  ?>">
<input type="hidden" name="enter_date" value="<? print ("$enter_date");  ?>">
<input type="hidden" name="activate_date" value="<? print ("$activate_date");  ?>">
<input type="hidden" name="visit_timestamp_received" value="<? print ("$visit_timestamp_received");  ?>">
<input type="hidden" name="visit_palm_db_id" value="<? print ("$visit_palm_db_id");  ?>">
<input type="hidden" name="username" value="<? print ("$USER_NAME");  ?>">
<input type="hidden" name="approved_for_billing" value="<? print ("$dcn_approved_for_billing");  ?>">
<?

if ($dcn_posted_for_billing =="Yes")
{
?>
<input name="action" type="submit" class="sbttn" value="Remove from Billing Batch" disabled="disabled">

<?
}
else if ($dcn_approved_for_billing =="Yes")
{
?>
<input class="sbttn" type="submit" name="action" value="Remove from Billing Batch">

<?

}
else
{
?>
<input name="action" type="submit" class="sbttn" value="Remove from Billing Batch" disabled="disabled">
<?

}
?>

</p>
</div>
</form>

Here, when i click on the Approve for Billing button, I need to change the defaulted flag dcn_approved_for_billing to 'Yes' and display the billingMgt.php screen again showing 'Yes' for the Approve for Billing field which was 'No' the first time round.

Also, if I click on Remove from Billing button on RecordDetails.php page(this is enabled only if value for dcn_approve_for_billing flag is set to 'Yes'), the flag value should be changed back to 'No' and that should again be displayed on the billingMgt.php screen. In other words, I need to pass the value back to the previous screen.

the situation here is, two diiferent buttons on one screen when clicked, change the value of the same flag(dcn_approve_for_billing) and take me to the same page (billingMgt.php) that was the first page in the chain!!

I need help in passing this changed flag value to the next/previous page - billingMgt.php from RecordDetails.php page. I am stuck at this point and not able to move any further.

thanx in advance
Link to comment
https://forums.phpfreaks.com/topic/33414-function-in-php/
Share on other sites

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.