Novice - Help with a page.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ben

    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_function s.php");

    session_registe r("srFIRSTNAME" );
    session_registe r("srSURNAME" );
    session_registe r("srTELEPHONE" );
    session_registe r("srEMAILADDR" );
    session_registe r("srLOCATION") ;
    session_registe r("srDETAILS" );
    session_registe r("srPAGE_NUM") ;

    include ("bdc_intranet_ connect.php");

    bdc_small_heade r("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>Ple ase 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>Fir st name</TD>
    <TD width="10" ALIGN=RIGHT>&nb sp;</TD>
    <TD width="357"><IN PUT TYPE=TEXT NAME=FIRSTNAME VALUE="<?PHP
    echo $srFIRSTNAME?>" SIZE=20 MAXLENGTH=20></TD>
    </TR>
    <TR>
    <TD ALIGN=RIGHT>Sur name</TD>
    <TD ALIGN=RIGHT>&nb sp;</TD>
    <TD><INPUT TYPE=TEXT NAME=SURNAME VALUE="<?PHP echo
    $srSURNAME?>" SIZE=20 MAXLENGTH=20></TD>
    </TR>
    <TR>
    <TD ALIGN=RIGHT>Tel ephone</TD>
    <TD ALIGN=RIGHT>&nb sp;</TD>
    <TD><INPUT TYPE=TEXT NAME=TELEPHONE VALUE="<?PHP echo
    $srTELEPHONE?>" SIZE=15 MAXLENGTH=15></TD>
    </TR>
    <TR>
    <TD ALIGN=RIGHT>Ema il Address</TD>
    <TD ALIGN=RIGHT>&nb sp;</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="JAVAS CRIPT">
    <!--
    document.PAGE_1 .FIRSTNAME.focu s()
    -->
    </SCRIPT>

    </DIV>

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

    <?PHP

    if ($PAGE_NUM == 2) {

    global $srLOCATION;
    global $srDETAILS;

    ?>
    <H5>Informati on 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>&n bsp;</TD>
    <TD width="277" align="left"><T EXTAREA 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>&n bsp;</TD>
    <TD align="left"><T EXTAREA 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="JAVAS CRIPT">
    <!--
    document.PAGE_2 .focus()
    -->
    </SCRIPT>
    </DIV>

    <H4 ALIGN=RIGHT>Que stionnaire 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>Confirmati on</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>Con tact Name: </TD>";
    print "<TD WIDTH=5></TD>";
    print "<TD>" . trim($srFIRSTNA ME) . " " . trim($srSURNAME ) .
    "</TD>";
    print "</TR>";
    print "<TR>";
    print "<TD ALIGN=RIGHT>Tel ephone: </TD>";
    print "<TD WIDTH=3></TD>";
    print "<TD>$srTELEPHO NE</TD>";
    print "</TR>";
    print "<TR>";
    print "<TD ALIGN=RIGHT>E-Mail Address: </TD>";
    print "<TD WIDTH=3></TD>";
    print "<TD>$srEMAILAD DR</TD>";
    print "</TR>";
    print "<TR>";
    print "<TD COLSPAN=3><HR></TD>";
    print "</TR>";
    print "<TR>";
    print "<TD ALIGN=RIGHT>Dat e 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>Iss ue Location:</TD>";
    print "<TD WIDTH=3></TD>";
    print "<TD><PRE>$srLO CATION</PRE></TD>";
    print "</TR>";
    print "<TR>";
    print "<TD VALIGN=TOP ALIGN=RIGHT>Iss ue Details:</TD>";
    print "<TD WIDTH=3></TD>";
    print "<TD><PRE>$srDE TAILS</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=$F IRSTNAME;
    $srSURNAME =$SURNAME;
    $srTELEPHONE=$T ELEPHONE;
    $srEMAILADDR=$E MAILADDR;

    if (Empty($FIRSTNA ME)) {
    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($TELEPHO NE)) {
    print "<H2 CLASS=ERROR>You have not entered your telephone
    number</H2>";
    $PAGE_NUM=1;
    }
    elseif (Empty($EMAILAD DR)) {
    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($LOCATIO N)) {
    print "<H2 CLASS=ERROR>Ple ase enter a location</H2>\n";
    $PAGE_NUM=2;
    }
    elseif (Empty($DETAILS )) {
    print "<H2 CLASS=ERROR>Ple ase 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_se q') 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_e mail(get_user_n ame($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@b romsgrove.gov.u k", "New Health, Safety and
    Maintenance Issue Logged", $message, "From: $mail_from" );
    mail("$email_ad dr", $SUBJECT, $BODY);

    session_unregis ter("srFIRSTNAM E");
    session_unregis ter("srSURNAME" );
    session_unregis ter("srTELEPHON E");
    session_unregis ter("srEMAILADD R");
    session_unregis ter("srLOCATION ");
    session_unregis ter("srDETAILS" );
    session_unregis ter("srPAGE_NUM ");

    ?>

    <H5>Confirmatio n</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=tr im($my_row[forename]);
    $srSURNAME =trim($my_row[surname]);
    $srTELEPHONE=tr im($my_row[telephone]);
    $srEMAILADDR=tr im($my_row[email]) . "@........gov.u k";

    $PAGE_NUM=1;
    }

    if ( $PAGE_NUM < 7) {
    log_a_call_form ($PHP_SELF, $PAGE_NUM);
    }
    ?>
  • Randell D.

    #2
    Re: Novice - Help with a page.


    "Ben" <benbrown@zoom. co.uk> wrote in message
    news:3e606552.0 310140351.3befd d5a@posting.goo gle.com...[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_function s.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?


    Comment

    • Paulus Magnus

      #3
      Re: Novice - Help with a page.

      "Ben" <benbrown@zoom. co.uk> wrote in message
      news:3e606552.0 310140351.3befd d5a@posting.goo gle.com...[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


      Comment

      Working...