[FX.php List] Simple form with fx.php

VanBuskirk, Patricia pvanbuskirk at otc.fsu.edu
Fri Jan 9 10:23:09 MST 2009


Apparently, I've gone brain dead since I did my forms (that currently
work fine) using fx.php!  I suppose the holidays can do that to one!
(FM9A on FMS9 on Win2000)

I am trying to do a VERY simple form (6 fields) and cannot get it to
work!  I copied most of it from the working forms.  When I submit, it
creates a blank record in the database, and this is what I see for the
confirmation page (I turned on display_errors in my php.ini file):

Notice: Undefined index: EmployeeName in
E:\inetpub\wwwroot\Forms\Repair\OTISconfirm.php on line 5

Notice: Undefined index: Department in
E:\inetpub\wwwroot\Forms\Repair\OTISconfirm.php on line 5

Notice: Undefined index: Area in
E:\inetpub\wwwroot\Forms\Repair\OTISconfirm.php on line 5

Notice: Undefined index: Description in
E:\inetpub\wwwroot\Forms\Repair\OTISconfirm.php on line 5

Notice: Undefined index: Date in
E:\inetpub\wwwroot\Forms\Repair\OTISconfirm.php on line 5

Notice: Undefined index: Order_RepairNo in
E:\inetpub\wwwroot\Forms\Repair\OTISconfirm.php on line 5

Warning: Illegal offset type in isset or empty in
E:\inetpub\wwwroot\Forms\Repair\OTISconfirm.php on line 22

Your Time Has Been Submitted.

Employee Name:  
Department:  
Area:  
Date:  
Description:  
Order/Repair #:   
Go Back and Enter More Time 

------------------------------------------------------------------------
-----------------------------

Here is the form code:

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Online OTIS Time Tracking Ticket</title>
<LINK href="repair.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style16 {font-size: 12px}
.style20 {font-size: 11px; font-family: Verdana, Arial, Helvetica,
sans-serif;}
-->
</style>
</head>
<BODY text=#000000 vLink=#666666 aLink=#cc0000 link=#990000
bgColor=#ffffff>
<form ACTION="OTISconfirm.php" METHOD="POST" name="form">
  <center>
                  <P><font size="1" face="Verdana, Arial, Helvetica,
sans-serif"><IMG src="/forms/images/OTISbanner.jpg" alt="banner"
width="625" height="65" /></font></P>
  </center>
            <center>
              <table width="625" border=0 cellpadding=6
bordercolor=#660000>
                <TBODY>
                  <TR valign=middle align="center">
                    <td width="286" align="right" valign="bottom"
class="style20"><strong>Employee Name: </strong></td>
                    <td width="309" align="left" valign="top">
                        <select name="EmployeeName" id="EmployeeName"
tabindex="1">
                          <option selected>Select Name ...</option>
                          <option value="Wayne Bell">Wayne Bell</option>
                          <option value="Daniel Kane">Daniel
Kane</option>
                          <option value="Mike Little">Mike
Little</option>
                          <option value="Marty McClamma">Marty
McClamma</option>
                          <option value="Trish Van Buskirk">Trish Van
Buskirk</option>
                                  </select></td>
                  </tr>
                </TBODY>
              </table>
              <table width="625" border=1 cellpadding="3"
cellspacing="0" borderColor=#660000 bgcolor="#660000"> 
                <TBODY> 
                  <TR borderColor=#660000 bgColor=#dece9c> 
                    <td align=center bgcolor="#660000"><font
color="#dece9c" face="Verdana, Arial, Helvetica, sans-serif"><font
color="#FFFFCC"><span class="style16">DEPARTMENT /
AREA</span></font></font><font color="#dece9c" size="1" face="Verdana,
Arial, Helvetica, sans-serif"><font color="#FFFFCC"><br> 
                    WORK DONE FOR</font></font></td> 
              </tr> 
                </TBODY> 
              </table>
              <table width="625" border="0" cellspacing="1"
cellpadding="6">
                <tr valign="middle">
                  <td height="89" colspan="3" align="center"
bgcolor="#E8E8E8"><p align="center"><span class="style2"><font
face="Verdana, Arial, Helvetica,
sans-serif"><strong>Department:</strong>&nbsp;</font></span>
                    <select size="1" name="Department" tabindex="2"
maxlength="20">
                      <option selected>TELECOMMUNICATIONS, OFFICE
OF</option>
                      <?php

require_once('FX.php');
require_once('server_data.php');
ini_set('display_errors', 'on');

// configure a connection to FileMaker Server Advanced
$ordersQuery = new FX(FM_IP, FM_PORT, FM_VERSION);
// set database and layout information
$ordersQuery->SetDBData('WEB_Forms', 'SG_Sections', 'all');
// set database username and password
$ordersQuery->SetDBUserPass(FM_USERNAME, FM_PASSWORD);
// retrieve all records in this database available to the current user
$ordersQuery->AddSortParam('SectionName', 'ascend');
$orders = $ordersQuery->DoFXAction(FX_ACTION_FINDALL);
	foreach ($orders as $contact) {
// the substr function below will take the string between the start and
stop numbers given within the commas (basically allows to 'crop' the
field)
echo substr ("<option>{$contact['SectionName']}\n", 0, 80);
}
?>
                    </select>
                    <br>
                  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(Change
using drop-down) </p>
                  <p><span class="style2"><font face="Verdana, Arial,
Helvetica, sans-serif">OTC Area:</font></span>
                    <select size="1" name="Area" tabindex="3">
                      <option selected> </option>
                      <option value="ACT">ACT</option>
                      <option value="ADM">ADM</option>
                      <option value="CASS">CASS</option>
                      <option value="CC">CC</option>
                      <option value="CRM">CRM</option>
                      <option value="ENG">ENG</option>
                      <option value="HD">HD</option>
                      <option value="IMR">IMR</option>
                      <option value="NET">NET</option>
                      <option value="OTIS">OTIS</option>
                      <option value="PUR">PUR</option>
					</select>
                  <span class="style20"> <span class="style13">(if
applicable)</span></span></td>
                </tr>
              </table>
              <table bordercolor=#660000 cellpadding=6 width="625"
border=0> 
                <TBODY> 
                  <TR valign=middle align="center"> 
                    <td colspan="2" bgcolor="#630000"><font
color="#FFFFFF" size="1" 
            face="Verdana, Arial, Helvetica, sans-serif">Details of Work
</font></td> 
              </tr>
                  <TR align="center" valign=middle>
                    <td align="right" valign="top" class="style20"><span
class="style2">Date:</span><br>
                      <span class="style13">(If other than today)
</span></td>
                   <?php
					$month = date('n');
					$day = date('d');

					$year = date('Y');
					?> 
					<td align="left"
valign="top"><input name="Date" type="text" id="Date" tabindex="4"
value="<?php echo ("$month/$day/$year"); ?>">&nbsp;&nbsp;&nbsp;&nbsp;
                      <span class="style2">Hours Worked:</span> 
<input name="Hours" type="text" size="7" tabindex="5">
</span></td>
                  </tr>
                  <TR align="center" valign=middle>
                    <td width="147" align="right" valign="top"
class="style20"><SPAN class="style2"><font face="Verdana, Arial,
Helvetica, sans-serif">Work Description: </font></SPAN></td>
                    <td width="448" align="left" valign="top"><TEXTAREA
tabindex=6 name="Description" rows=7 wrap="physical"
cols=70></TEXTAREA></td>
                  </tr>
                  <TR valign=middle align="center">
                    <td align="right" valign="top" class="style20"><span
class="style2">Order/Ticket Number:</span><br>
<span class="style13">(if applicable)</span></td>
                    <td align="left" valign="top"><input
name="Order_RepairNo" type="text" id="Order_RepairNo" tabindex="7"></td>
                  </tr>
                </TBODY> 
              </table>
              <table width="625" border=0 cellpadding=10
bordercolor=#660000>
            <TBODY>
              <TR valign=middle align="center">
                <td><SPAN class="style20">
                  <input name="new_record" type="submit" id="new_record"
tabindex="8" value="Submit Time"/>
                </SPAN>&nbsp;&nbsp;&nbsp;<font size="1" 
                  face="Verdana, Arial, Helvetica, sans-serif">
                    <input name="reset" type="reset" id="reset"
tabindex="9" value="Reset Form">
                    </font></td></tr>
            </TBODY>
              </table>
  </center>
</form> 
</table>
</body>
</html>
------------------------------------------------------------------------
------------------------------
NOW THE CONFIRM PAGE:

<?php
require_once('FX.php');
require_once('server_data.php');

$newRecordArray = array('EmployeeName' =>
$_POST['EmployeeName'],'Department' => $_POST['Department'],'Area' =>
$_POST['Area'],'Description' => stripslashes($_POST['Description']),
'Date' => $_POST['Date'], 'Order_RepairNo' => $_POST['Order_RepairNo']);
	
// configure a connection to FileMaker Server Advanced
$ordersQuery = new FX(FM_IP, FM_PORT, FM_VERSION);
// set database and layout information
$ordersQuery->SetDBData('OTC_Time_Tracker.fp7', 'OTIS_Time');
// set database username and password
$ordersQuery->SetDBUserPass(FM_USERNAME, FM_PASSWORD);
// retrieve all records in this database available to the current user
// add parameter array for new record
$ordersQuery->AddDBParamArray($newRecordArray);
// retrieve all checkbox info 
// add parameter array for new record
// Add pararameters for the checkboxes.  This allows some to be not
checked without an error.
$orders = $ordersQuery->DoFXAction(FX_ACTION_NEW);

foreach($orders as $order) {
	if(isset($_POST[$order])) {
		$ordersQuery->AddDBParam($order, $_POST[$order]);
		}
	}
?>

<!--THIS IS WHERE THE ON-SCREEN CONFIRMATION INFO BEGINS-->
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>OTIS Time Tracking Confirmation</title>
<style type="text/css">
<!--
.style1 {
	font-size: medium;
	font-weight: bold;
	font-family: Verdana, Arial, Helvetica, sans-serif;
}
.style2 {font-family: Verdana, Arial, Helvetica, sans-serif}
.style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size:
12px; }
.style4 {
	font-size: 12px;
	font-weight: bold;
}
.style5 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size:
12px; font-weight: bold; }
-->
</style>
</head>
<BODY>
<p class="style1">Your Time Has Been Submitted.</p>
<table width="80%" border="0" cellspacing="0" cellpadding="6">
  <tr>
    <td width="36%" align="right" class="style5">Employee Name:</td>
    <td width="64%" class="style2"><span class="style4"><?php echo
($order['EmployeeName']); ?></span></td>
  </tr>
  <tr>
    <td align="right" class="style5">Department:</td>
    <td class="style3"><span class="style4"><?php echo
($order['Department']); ?></span></td>
  </tr>
  <tr>
    <td align="right" class="style5">Area:</td>
    <td class="style3"><span class="style4"><?php echo ($order['Area']);
?></span></td>
  </tr>
  <tr>
    <td align="right" class="style5">Date:</td>
    <td class="style3"><span class="style4"><?php echo ($order['Date']);
?></span></td>
  </tr>
  <tr>
    <td align="right" class="style5">Description:</td>
    <td class="style3"><span class="style4"><?php echo
($order['Description']); ?></span></td>
  </tr>
  <tr>
    <td align="right" class="style5">Order/Repair #: </td>
    <td class="style3"><span class="style4"><?php echo
($order['Order_RepairNo']); ?></span></td>
  </tr>
  <tr>
    <td height="46" colspan="2" align="center" valign="bottom"
class="style5"><a href="OTIStime.php">Go Back and Enter More
Time</a></td>
  </tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>


More information about the FX.php_List mailing list