homepage Welcome to WebmasterWorld Guest from 54.166.53.169
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Please help
kenny724



 
Msg#: 4371671 posted 9:19 pm on Oct 6, 2011 (gmt 0)

Can someone please help with this script? What needs to be done is if the MD approves the form...all of the signatures need to be added to their respective fields. Can someone give me some pointers? Thanks.



<?php

// Include this file to add signatures to the print output
// This file will set two signature variables: md_sig and clinician_sig

//first step is to use the query results from the cpt_form.inc for the billed_by var
if(IsSet($billed_by))
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $billed_by";
else
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $completed_by_fk";
//echo "clinician_sig: $sql_query <br />";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$clinician_sig = $sql_array[0];
$clinician_name_string = "$sql_array[1] $sql_array[2]";

if(file_exists($clinician_sig))
$clinician_sig = "<img src=\"$clinician_sig\" border=\"0\" />";
else
$clinician_sig = "<br /><br /><br />";

//now clean up the date format
if(IsSet($completed_date))
$completed_date_string = strftime("%m/%d/%Y", strtotime($completed_date));
else
$completed_date_string="";

if(IsSet($approved_by) && $approved_by != "")
{
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $approved_by";
//echo "md_sig: $sql_query <br />";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$md_sig = $sql_array[0];
//echo "sig: $md_sig <br />";
$md_name_string = "$sql_array[1] $sql_array[2]";

if(file_exists($md_sig))
{
$md_sig = "<img src=\"$md_sig\" border=\"0\" alt=\"\" />";
}

else
{
$md_sig = "<br /><br /><br />";
}
//now clean up the date format
$approved_date_string = strftime("%m/%d/%Y", strtotime($approved_date));
}
else
{
$md_sig = "<br /><br /><br />";
$md_name_string = "";
$approved_date_string="";
}

if(IsSet($psychiatrist_id_fk) && $psychiatrist_id_fk != 0)
{
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $psychiatrist_id_fk";
//echo "md_sig: $sql_query <br />";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$psychiatrist_sig = $sql_array[0];
$psychiatrist_name_string = "$sql_array[1] $sql_array[2]";

/*if(file_exists($psychiatrist_sig))
$psychiatrist_sig = "<img src=\"$psychiatrist_sig\" border=\"0\" alt=\"test\" />";
else*/
$psychiatrist_sig = "<br /><br /><br />";
}
else
{
$psychiatrist_sig = "<br /><br /><br />";
$psychiatrist_name_string = "";
}

if(IsSet($therapist_id_fk) && $therapist_id_fk != 0)
{
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $therapist_id_fk";
//echo "md_sig: $sql_query <br />";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$therapist_sig = $sql_array[0];
$therapist_name_string = "$sql_array[1] $sql_array[2]";

/*if(file_exists($therapist_sig))
$therapist_sig = "<img src=\"$therapist_sig\" border=\"0\" alt=\"test\" />";
else*/
$therapist_sig = "<br /><br /><br />";
}
else
{
$therapist_sig = "<br /><br /><br />";
$therapist_name_string = "";
}

if(IsSet($activity_therapist_id_fk) && $activity_therapist_id_fk != 0)
{
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $activity_therapist_id_fk";
//echo "md_sig: $sql_query <br />";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$activity_therapist_sig = $sql_array[0];
$activity_therapist_name_string = "$sql_array[1] $sql_array[2]";

/*if(file_exists($activity_therapist_sig))
$activity_therapist_sig = "<img src=\"$activity_therapist_sig\" border=\"0\" alt=\"test\" />";
else*/
$activity_therapist_sig = "<br /><br /><br />";
}
else
{
$activity_therapist_sig = "<br /><br /><br />";
$activity_therapist_name_string = "";
}

if(IsSet($case_manager_id_fk) && $case_manager_id_fk != 0)
{
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $case_manager_id_fk";
//echo "md_sig: $sql_query <br />";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$case_manager_sig = $sql_array[0];
$case_manager_name_string = "$sql_array[1] $sql_array[2]";

/*if(file_exists($case_manager_sig))
$case_manager_sig = "<img src=\"$case_manager_sig\" border=\"0\" alt=\"test\" />";
else*/
$case_manager_sig = "<br /><br /><br />";
}
else
{
$case_manager_sig = "<br /><br /><br />";
$case_manager_name_string = "";
}


if(IsSet($other_id_fk) && $other_id_fk != 0)
{
$sql_query = "SELECT sig_file, user_first_name, user_last_name FROM users_table WHERE user_id_pk = $other_id_fk";
//echo "md_sig: $sql_query <br />";
$sql_query_result = mysql_query($sql_query) or die ("Error in sql_query2 signatures.inc");
$sql_array = mysql_fetch_array($sql_query_result);
$other_sig = $sql_array[0];
$other_name_string = "$sql_array[1] $sql_array[2]";

/*if(file_exists($other_sig))
$other_sig = "<img src=\"$other_sig\" border=\"0\" alt=\"test\" />";
else*/
$other_sig = "<br /><br /><br />";
}
else
{
$other_sig = "<br /><br /><br />";
$other_name_string="";
}

?>

 

eelixduppy

WebmasterWorld Senior Member eelixduppy us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 4371671 posted 1:09 am on Oct 7, 2011 (gmt 0)

This would be much cleaner if you used an array of signatures and with a single query to the table instead of a new one each time.

Also, I'm still unsure what you are asking for here -- could you please elaborate?

lucy24

WebmasterWorld Senior Member lucy24 us a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



 
Msg#: 4371671 posted 2:14 am on Oct 7, 2011 (gmt 0)

This would be much cleaner if you used an array of signatures and with a single query to the table instead of a new one each time.

Hear, hear. I make it five identical routines that can be tucked into a single for/next loop. (Though I do recommend a comment line saying "1=psychiatrist, 2=therapist" etc. so future human readers will know who is who. Or even named constants.)

And don't you want an overall "if" loop? One that says (in English, in your words) "if the MD approves the form...all of the signatures need to be added to their respective fields", where "all of the signatures" is your five-element array. Probably no "else", since it either happens or doesn't happen.

Uneasily wondering whether everyone concerned, including the relevant governmental agencies, knows that the "signatures" are really image files pulled together by a program that only requires one person's approval.

kenny724



 
Msg#: 4371671 posted 6:12 pm on Oct 7, 2011 (gmt 0)

Thanks. I'll try writing an array. I'm using someone else's computer. Got mad, and messed my laptop up...so I gotta fix it. I would make like array[3] with signatures all of signatures and edit the if else with the md signature, correct?

Thanks again,
Kenny

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved