rsammy Posted January 9, 2007 Share Posted January 9, 2007 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. 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:[code]<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> </td><td> </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> </td><td> </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>[/code]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.shud i write a funtion or something like that in php that'll return a Yes or No for the flag when button is pressed? if yes, how do i do it? ditto with javascript???!!!thanx in advance Link to comment https://forums.phpfreaks.com/topic/33415-help-with-function/ Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 If your values are being stored for these 2 flags in your database, then in theory you should be able to call the values on both pages from the database..use this for changing the values in the database:[code]UPDATE `table` SET `field` = 'value' WHERE `field` = 'value';[/code]when you update the value and it is drawn back to the page it should auto update your buttons if they are set to work correctly and should autoupdate the pages the flags are displayed on if you coded the page correctly Link to comment https://forums.phpfreaks.com/topic/33415-help-with-function/#findComment-156345 Share on other sites More sharing options...
rsammy Posted January 9, 2007 Author Share Posted January 9, 2007 i am able to get the values in both pages. but, i need to update the flag(s) as either Yes or No based on button clicked and send control back to same page(previous page where we came from) when either of the button is clicked. is thispossible? to send control back to same page irrespective of which button is clicked. i have one update query and it works. how do i do it for the other button and where? Link to comment https://forums.phpfreaks.com/topic/33415-help-with-function/#findComment-156692 Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 maybe try some javascript?onClick="location.href='myPage.php';" Link to comment https://forums.phpfreaks.com/topic/33415-help-with-function/#findComment-156751 Share on other sites More sharing options...
rsammy Posted January 9, 2007 Author Share Posted January 9, 2007 where do i put this javascript code? Link to comment https://forums.phpfreaks.com/topic/33415-help-with-function/#findComment-156821 Share on other sites More sharing options...
rsammy Posted January 9, 2007 Author Share Posted January 9, 2007 i am actually able to post the variable now! it carries the current value in the database. but i shud be able to change the flag value when i click on the button! where shud i change the value. not sure where exactly in the code shud i assign or change the value of the flag so i can update using the update qeury after i post it. Link to comment https://forums.phpfreaks.com/topic/33415-help-with-function/#findComment-156842 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.