Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 17th, 2005, 01:32 AM
Ben
Guest
 
Posts: n/a
Default Novice - Help with a page.

The page below isn't picking up details or location.

What have I missed?


Thanks in advance,

Ben
____________________________________________
<?PHP

include ("bdc_functions.php");
include ("user_functions.php");

session_register("srFIRSTNAME");
session_register("srSURNAME");
session_register("srTELEPHONE");
session_register("srEMAILADDR");
session_register("srLOCATION");
session_register("srDETAILS");
session_register("srPAGE_NUM");

include ("bdc_intranet_connect.php");

bdc_small_header("Health Safety and Maintenance Logging");

function log_a_call_form( $SELF, $PAGE_NUM ) {

?>

<title></title>
<H2>Health Safety and Maintenance Logging System</H2>

<?PHP

if ($PAGE_NUM == 1) {
global $srFIRSTNAME;
global $srSURNAME;
global $srTELEPHONE;
global $srEMAILADDR;

?>
<table width="95%" border="0" align="center">
<tr>
<td height="48"><h5>Please complete this form to log any issues
relating to health, safety and maintenance around the Bromsgrove
District Council offices.</h5>
</td>
</tr>
</table>

<H5>Contact Details.</H5>
<table width="95%" border="0" align="center">
<tr>
<td height="48"></td><P>This form will be filled in with details
obtained from your intranet log on details.<br>Please change these
details if they are incorrect.</P>
</td>
</tr>
</table>

<DIV>
<FORM ACTION=<?PHP echo $SELF ?> METHOD=POST NAME=PAGE_1>
<TABLE width="496">
<TR>
<TD width="113" ALIGN=RIGHT>First name</TD>
<TD width="10" ALIGN=RIGHT>&nbsp;</TD>
<TD width="357"><INPUT TYPE=TEXT NAME=FIRSTNAME VALUE="<?PHP
echo $srFIRSTNAME?>" SIZE=20 MAXLENGTH=20></TD>
</TR>
<TR>
<TD ALIGN=RIGHT>Surname</TD>
<TD ALIGN=RIGHT>&nbsp;</TD>
<TD><INPUT TYPE=TEXT NAME=SURNAME VALUE="<?PHP echo
$srSURNAME?>" SIZE=20 MAXLENGTH=20></TD>
</TR>
<TR>
<TD ALIGN=RIGHT>Telephone</TD>
<TD ALIGN=RIGHT>&nbsp;</TD>
<TD><INPUT TYPE=TEXT NAME=TELEPHONE VALUE="<?PHP echo
$srTELEPHONE?>" SIZE=15 MAXLENGTH=15></TD>
</TR>
<TR>
<TD ALIGN=RIGHT>Email Address</TD>
<TD ALIGN=RIGHT>&nbsp;</TD>
<TD><INPUT TYPE=TEXT NAME=EMAILADDR VALUE="<?PHP echo
$srEMAILADDR?>" SIZE=50 MAXLENGTH=50></TD>
</TR>
</TABLE>
<BR>
<INPUT TYPE=SUBMIT NAME=NEXT_1 VALUE=Next>
</FORM>

<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
document.PAGE_1.FIRSTNAME.focus()
-->
</SCRIPT>

</DIV>

<H4 ALIGN=RIGHT>Page <?PHP echo $PAGE_NUM ?> of 3</H4>
<?PHP
}
?>

<?PHP

if ($PAGE_NUM == 2) {

global $srLOCATION;
global $srDETAILS;

?>
<H5>Information about the issue</H5>
<DIV>
<FORM ACTION=<?PHP echo $SELF ?> METHOD=POST NAME=PAGE_2>
<TABLE width="600" height="271">
<TR valign="middle">
<TD height="31" ALIGN=right valign="middle"> Please enter the
location <BR>of the issue?</TD>
<TD ALIGN=center>&nbsp;</TD>
<TD width="277" align="left"><TEXTAREA NAME=LOCATION ROWS=5
COLS=40><?PHP echo $srLOCATION?></TEXTAREA>
</TD>
</TR>
<TR valign="middle">
<TD height="117" ALIGN=right VALIGN=middle> Please enter
details <br>about the issue</TD>
<TD ALIGN=center>&nbsp;</TD>
<TD align="left"><TEXTAREA NAME=DETAILS ROWS=5 COLS=40><?PHP
echo $srDETAILS?></TEXTAREA></TD>
</TR>
</TABLE>
<BR>
<INPUT TYPE=SUBMIT NAME=BACK_2 VALUE=Back>
<INPUT TYPE=SUBMIT NAME=NEXT_2 VALUE=Next>
</FORM>

<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
document.PAGE_2.focus()
-->
</SCRIPT>
</DIV>

<H4 ALIGN=RIGHT>Questionnaire Page <?PHP echo $PAGE_NUM ?> of 3</H4>
<?PHP
}
?>

<?PHP

if ($PAGE_NUM == 3) {

global $srFIRSTNAME;
global $srSURNAME;
global $srTELEPHONE;
global $srEMAILADDR;
global $srLOCATION;
global $srDETAILS;
$DATE = date('jS F Y');


print "<H4>Confirmation</H4>";
print "<H5>Click 'Back' to change anything, or press 'Submit' to
process the form</H5>";
print "<TD COLSPAN=3><HR></TD>";
print "<DIV>";
print "<TABLE>";
print "<TR>";
print "<TD ALIGN=RIGHT>Contact Name: </TD>";
print "<TD WIDTH=5></TD>";
print "<TD>" . trim($srFIRSTNAME) . " " . trim($srSURNAME) .
"</TD>";
print "</TR>";
print "<TR>";
print "<TD ALIGN=RIGHT>Telephone: </TD>";
print "<TD WIDTH=3></TD>";
print "<TD>$srTELEPHONE</TD>";
print "</TR>";
print "<TR>";
print "<TD ALIGN=RIGHT>E-Mail Address: </TD>";
print "<TD WIDTH=3></TD>";
print "<TD>$srEMAILADDR</TD>";
print "</TR>";
print "<TR>";
print "<TD COLSPAN=3><HR></TD>";
print "</TR>";
print "<TR>";
print "<TD ALIGN=RIGHT>Date Logged:</TD>";
print "<TD WIDTH=3></TD>";
print "<TD>$DATE</TD>";
print "</TR>";
print "<TR>";
print "<TD COLSPAN=3><HR></TD>";
print "</TR>";
print "<TR>";
print "<TD VALIGN=TOP ALIGN=RIGHT>Issue Location:</TD>";
print "<TD WIDTH=3></TD>";
print "<TD><PRE>$srLOCATION</PRE></TD>";
print "</TR>";
print "<TR>";
print "<TD VALIGN=TOP ALIGN=RIGHT>Issue Details:</TD>";
print "<TD WIDTH=3></TD>";
print "<TD><PRE>$srDETAILS</PRE></TD>";
print "</TR>";
print "</TABLE>";
print "</DIV>";
print "<BR>";
print "<DIV>";
print "<FORM ACTION=$SELF METHOD=POST NAME=PAGE_3>";
print "<INPUT TYPE=SUBMIT NAME=BACK_3 VALUE=Back>";
print "<INPUT TYPE=SUBMIT NAME=SAVE VALUE=Submit>";
print "</FORM>";
print "</DIV>";

}

?>

<?PHP
}
?>

<?PHP

$PAGE_NUM=0;
$dbh = db_connect();

if ($NEXT_1) {

$srFIRSTNAME=$FIRSTNAME;
$srSURNAME =$SURNAME;
$srTELEPHONE=$TELEPHONE;
$srEMAILADDR=$EMAILADDR;

if (Empty($FIRSTNAME)) {
print "<H2 CLASS=ERROR>You have not entered your
firstname</H2>";
$PAGE_NUM=1;
}
elseif (Empty($SURNAME)) {
print "<H2 CLASS=ERROR>You have not entered your
surname</H2>";
$PAGE_NUM=1;
}
elseif (Empty($TELEPHONE)) {
print "<H2 CLASS=ERROR>You have not entered your telephone
number</H2>";
$PAGE_NUM=1;
}
elseif (Empty($EMAILADDR)) {
print "<H2 CLASS=ERROR>You have not entered your email
address</H2>";
$PAGE_NUM=1;
}
else {
$PAGE_NUM=2;
}
}
if ($NEXT_2) {
$srLOCATION =$LOCATION;
$srDETAILS =$DETAILS;

if (Empty($LOCATION)) {
print "<H2 CLASS=ERROR>Please enter a location</H2>\n";
$PAGE_NUM=2;
}
elseif (Empty($DETAILS)) {
print "<H2 CLASS=ERROR>Please enter general information about
your call</H2>\n";
$PAGE_NUM=2;
}
else {
$PAGE_NUM=3;
}
)

if ($SAVE) {
$sql_str = "INSERT INTO hsm_details ( ";
$sql_str .= " logged_by ,";
$sql_str .= " telephone ,";
$sql_str .= " emailaddr ,";
$sql_str .= " location ,";
$sql_str .= " details ,";
$sql_str .= " logged_at )";
$sql_str .= "VALUES ( ";
$sql_str .= " '$srFIRSTNAME' '$srSURNAME', ";
$sql_str .= " '$srTELEPHONE', ";
$sql_str .= " '$srEMAILADDR', ";
$sql_str .= " '$srLOCATION', ";
$sql_str .= " '$srDETAILS' ,";
$sql_str .= " now() ) ";

print $sql_str;
$result = pg_exec($dbh, $sql_str);

$sql_str = "SELECT currval('hsm_seq') as next_hsm_id";
$result = pg_exec($dbh, $sql_str);
$row = pg_fetch_array($result, 0);

$HSM_REF = " " . trim($row[next_hsm_id]);

$SUBJECT = "Health, Safety and Maintenance Issue Logged";
$BODY = "This email confirms that your issue has been logged and
passed on to Direct Services. Thank you for your time. If you need any
other information or help - please call....";

$full_name = get_full_name($LOGIN_ID);
$email_addr = trim(get_user_email(get_user_name($LOGIN_ID))) .
"@..........gov.uk" ;
$mail_from = "$full_name <" .
get_user_email(get_user_name($LOGIN_ID)) .">";
$message = "A new Health, Safety and Maintenance issue has been
logged. Ref $HSM_REF" ;


mail("b.brown@bromsgrove.gov.uk", "New Health, Safety and
Maintenance Issue Logged", $message, "From: $mail_from" );
mail("$email_addr", $SUBJECT, $BODY);

session_unregister("srFIRSTNAME");
session_unregister("srSURNAME");
session_unregister("srTELEPHONE");
session_unregister("srEMAILADDR");
session_unregister("srLOCATION");
session_unregister("srDETAILS");
session_unregister("srPAGE_NUM");

?>

<H5>Confirmation</H5>
<P>Thank you for loggin an issue.<BR>
<BR>
<P>Your logged issue has been submitted and passed on to Direct
Services.<BR>
<BR>
<DIV>
<FORM>
<INPUT TYPE=BUTTON VALUE="Close" NAME=CLOSE
onclick="window.close()">
</FORM>
</DIV>



<?PHP
$PAGE_NUM=99;
}

if ($BACK_3) { $PAGE_NUM=2; }
if ($BACK_2) { $PAGE_NUM=1; }

if ($PAGE_NUM==0) {
$sql_str = "SELECT forename, surname, telephone, email ";
$sql_str .= "FROM Users ";
$sql_str .= "WHERE id = $LOGIN_ID";

$result = pg_exec( $dbh, $sql_str );

$my_row = pg_fetch_array( $result, 0 );

$srFIRSTNAME=trim($my_row[forename]);
$srSURNAME =trim($my_row[surname]);
$srTELEPHONE=trim($my_row[telephone]);
$srEMAILADDR=trim($my_row[email]) . "@........gov.uk";

$PAGE_NUM=1;
}

if ( $PAGE_NUM < 7) {
log_a_call_form($PHP_SELF, $PAGE_NUM);
}
?>
  #2  
Old July 17th, 2005, 01:32 AM
Randell D.
Guest
 
Posts: n/a
Default Re: Novice - Help with a page.


"Ben" <benbrown@zoom.co.uk> wrote in message
news:3e606552.0310140351.3befdd5a@posting.google.c om...[color=blue]
> The page below isn't picking up details or location.
>
> What have I missed?
>
>
> Thanks in advance,
>
> Ben
> ____________________________________________
> <?PHP
>
> include ("bdc_functions.php");
> include ("user_functions.php");[/color]

<snipped>

Your question is unclear... how do you mean "not picking up details or
location"... What variables do you expect to be picked up and making the
assumption that you are forms processing, have you tried dumping your form
to a phpinfo() output and then checking for whatever info that you are
missing?


  #3  
Old July 17th, 2005, 01:32 AM
Paulus Magnus
Guest
 
Posts: n/a
Default Re: Novice - Help with a page.

"Ben" <benbrown@zoom.co.uk> wrote in message
news:3e606552.0310140351.3befdd5a@posting.google.c om...[color=blue]
> The page below isn't picking up details or location.
>
> What have I missed?[/color]

Perhaps you should narrow the problem down to a series of lines, or a subset
of your code and repost the snippet. Nobody wants to read through a 100
lines of code to work out exactly where the problem lies when you've got
such a large script that is multiple pages and that would take somebody a
long time to test.

Paulus


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles