By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,030 Members | 1,997 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,030 IT Pros & Developers. It's quick & easy.

Novice - Help with a page.

P: n/a
Ben
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.*****@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);
}
?>
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Ben" <be******@zoom.co.uk> wrote in message
news:3e**************************@posting.google.c om...
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");


<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?
Jul 17 '05 #2

P: n/a
"Ben" <be******@zoom.co.uk> wrote in message
news:3e**************************@posting.google.c om...
The page below isn't picking up details or location.

What have I missed?


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
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.