This is probably a lot more than you asked for but here is the additional code. If I put in numbers, regardless of number of characters, it saves the information and displays it properly. If I put in text, it deletes all fields. Thank you for your help!
function OvenProfileList( $oven_id="" )
{
if( !$oven_id )
$oven_id = $this->DecodeUrlStr("oven_id");
$oven_id_condition = ($oven_id)?" and oven_id = $oven_id":"";
$sqlQuery="SELECT ovenprofile_id,recipe_name,oven_name FROM ovenprofiles, ovens, recipes where ovenprofile_oid = oven_id and ovenprofile_prd_id = recipe_id $oven_id_condition Order by ";
if( $this->DecodeUrlStr("SORT") )
$sqlQuery.="oven_name, recipe_name";
else
$sqlQuery.="recipe_name, oven_name";
$this->ListAll($sqlQuery , "OVENPROFILE" , "ovenprofile_id" , array("recipe_name","oven_name") , "Recipe Oven Profiles" , array("<a href=\"?RUN_TYPE=LIST_OVENPROFILE\"><font color='white'>Recipe Name</font></a>", "<a href=\"?RUN_TYPE=LIST_OVENPROFILE&SORT=1\"><font color='white'>Oven Name</font></a>",
"Preview" ), array(array("VIEW_OVENPROFILE&TAB=1", "Preview") ));
}
function OvenProfileEdit()
{
global $ovenprofile_flds;
$ovenprofile_flds[0][3] = $this->GenerateIdList("Select oven_id,oven_name FROM ovens Order by oven_id" , "oven_name" , "oven_id");
$ovenprofile_flds[1][3] = $this->GenerateIdList("Select recipe_id,recipe_name FROM recipes Order by recipe_name" , "recipe_name" , "recipe_id");
$ovenprofile_flds[2][3] = $this->GenerateIdList("Select vessel_id,vessel_name FROM vessels Order by vessel_name" , "vessel_name" , "vessel_id");
$ovenprofile_id_val=$this->DecodeUrlStr("ovenprofile_id");
if($ovenprofile_id_val)
{
$sqlQuery = "Select * from ovenprofiles WHERE ovenprofile_id = $ovenprofile_id_val";
$this->SelectQuery($sqlQuery);
$rowArray = $this->m_data_rows[0];
}
echo("<H3> Recipe Oven Profile</H3>\n");
echo("<FORM METHOD=\"POST\" ENCTYPE=\"multipart/form-data\" ACTION=\"$this->m_submit_page\"><TABLE>\n");
echo("<INPUT TYPE=HIDDEN NAME=RUN_TYPE VALUE=\"SAVE_OVENPROFILE\">\n");
echo("<INPUT TYPE=HIDDEN NAME=ovenprofile_id VALUE=\"$ovenprofile_id_val\">\n");
$cnt=count( $ovenprofile_flds );
for($i=0;$i<$cnt;$i++)
{
if(!$ovenprofile_id_val)
$this->BuildHtml($ovenprofile_flds[$i]);
else
$this->BuildHtml($ovenprofile_flds[$i],$rowArray[$ovenprofile_flds[$i][0]]);
}
$this->OvenProfileEvents($ovenprofile_id_val);
echo("<tr>\n");
echo(" <td colspan=2> <input type=\"submit\" name=\"submit\" id=\"submit\" value=\"submit\" /> </td>\n ");
echo(" </tr>\n");
echo("</TABLE></FORM>\n");
}
function OvenProfilePersistence($delete=0)
{
global $ovenprofile_flds;
$action = "Added";
$ovenprofile_id_val=$this->DecodeUrlStr("ovenprofile_id");
if( $ovenprofile_id_val )
$action = "Updated";
if( $delete )
{
$action = "Deleted";
$this->SendNotificationEmail( $action, $ovenprofile_id_val );
}
$id_val = $this->Persistence("ovenprofiles" , "ovenprofile_id" , $ovenprofile_flds, $delete);
$this->SendNotificationEmail( $action, $id_val );
if( $delete )
$this->DeleteFile(0);
$this->SaveOvenProfileEvents( $delete, $id_val );
if( !$delete )
$this->IndexRecipe( $id_val );
$this->OvenProfileList($this->DecodeUrlStr("ovenprofile_oid"));
}
function SendNotificationEmail( $action, $id_val )
{
$sqlQuery = "SELECT ovenprofile_id, oven_name,recipe_name FROM ovenprofiles, ovens, recipes where ovenprofile_oid = oven_id and ovenprofile_prd_id = recipe_id and ovenprofile_id = $id_val";
//echo( $sqlQuery );
$this->SelectQuery($sqlQuery);
if( $this->m_row_count )
{
$rowArray = $this->m_data_rows[0];
$subject="Oven Recipe Notification - $action";
$body= "The following profile was $action on ".date("m-d-Y h:i A")." \n";
$body.= "ID : ".$rowArray["ovenprofile_id"]."\n" ;
$body.= "Oven Name : ".$rowArray["oven_name"]."\n" ;
$body.= "Recipe Name : ".$rowArray["recipe_name"]."\n" ;
ini_set("SMTP","MailB3.webcontrolcenter.com");
ini_set("smtp_port","25");
ini_set("sendmail_from","example@example.com");
$headers = "From: example@example.com\r\n";
$headers .= "cc: example2@example.com\r\n";
//$headers .= "cc: example2@example.com";
//$to_email = 'example2@example.com';
$to_email = 'example3@example.com';
//echo( "$body" );
if(!mail ($to_email, $subject, $body, $headers ))
echo "<font color='red'><h2>Your Message Was Not Sent!</h2></font>";
}
}
function OvenProfileEvents($id_val)
{
echo( "<table border=1>" );
echo( "<tr bgcolor=\"#aaaaaa\"><td>Event</td><td>%Time</td><td>%TAir</td><td>%BAir</td><td>%Wave</td><td>RevAirTime</td><td>Save</td></tr>\n" );
$events = array();
$max_events = 0;
if( $id_val )
{
$sqlQuery = "Select * from ovenprofileevents WHERE oe_op_id = $id_val order by oe_seq_id";
$this->SelectQuery($sqlQuery);
for( $i=0; $i< $this->m_row_count; $i++ )
{
$rowArray = $this->m_data_rows[$i];
$events[$i+1] = array( $rowArray["oe_time"], $rowArray["oe_air"], $rowArray["oe_bottom_air"], $rowArray["oe_wave"], $rowArray ["oe_rev_air"] );
$max_events++;
}
}
for( $i=1; $i<=10 ;$i++ )
{
$time_val = ($max_events>($i-1))? $events[$i][0]:0;
$air_val = ($max_events>($i-1))? $events[$i][1]:0;
$bot_air_val = ($max_events>($i-1))? $events[$i][2]:0;
$wave_val = ($max_events>($i-1))? $events[$i][3]:0;
$rev_air_val = ($max_events>($i-1))? $events[$i][4]:0;
$checked = ($max_events>($i-1))? "checked":"";
echo( "<tr><td>$i</td>");
echo( "<td><input name=\"time_$i\" value='$time_val' size='2'></td>");
echo( "<td><input name=\"air_$i\" value='$air_val' size='2'></td>");
echo( "<td><input name=\"bot_air_$i\" value='$bot_air_val' size='2'></td>");
echo( "<td><input name=\"wave_$i\" value='$wave_val' size='5'></td>");
echo( "<td><input name=\"rev_air_$i\" value='$rev_air_val' size='2'></td>");
echo( "<td><input type='checkbox' name=\"save_$i\" value='1' $checked ></td>");
echo( "</tr>" );
}
echo( "</table>" );
}
function SaveOvenProfileEvents( $delete, $id_val )
{
$this->ExecuteQuery("Delete from ovenprofileevents where oe_op_id=".$id_val);
$cnt = 1;
if( !$delete )
{
for( $i=1; $i<=10 ;$i++ )
{
if( $this->DecodeUrlStr( "save_$i" ) )
{
$sqlQuery="INSERT INTO ovenprofileevents ( oe_op_id, oe_seq_id, oe_time, oe_air, oe_bottom_air, oe_wave, oe_rev_air ) VALUES ( $id_val, $cnt" ;
$sqlQuery.=",".$this->DecodeUrlStr( "time_$i",0 );
$sqlQuery.=",".$this->DecodeUrlStr( "air_$i",0 );
$sqlQuery.=",".$this->DecodeUrlStr( "bot_air_$i",0 );
$sqlQuery.=",".$this->DecodeUrlStr( "wave_$i",0 );
$sqlQuery.=",".$this->DecodeUrlStr( "rev_air_$i",0 );
$sqlQuery.=")";
//echo( $sqlQuery );
$this->ExecuteQuery( $sqlQuery );
$cnt++;
}
}
}
}
function ViewOvenProfile()
{
global $PRIMARY_URL;
header("location: ".$PRIMARY_URL."details.php?ovenprofile_id=".$this->DecodeUrlStr( "ovenprofile_id" ) );
}
function DeleteFile($redirect=1)
{
global $IMG_FOLDER;
global $PDF_FOLDER;
$recipe_id = $this->DecodeUrlStr( "recipe_id" );
$oven_profile_id = $this->DecodeUrlStr( "ovenprofile_id" );
if( $recipe_id )
{
@unlink($IMG_FOLDER."recipe_img_url_".$recipe_id.".jpg" );
@unlink($IMG_FOLDER."recipe_small_img_url_".$recipe_id.".jpg" );
if( $redirect )
{
$this->ExecuteQuery("Update recipes set recipe_img_url = '' where recipe_id=".$recipe_id);
$this->RecipeEdit();
}
}
if( $oven_profile_id )
{
@unlink($PDF_FOLDER."ovenprofile_pdf_url_".$oven_profile_id.".pdf" );
if( $redirect )
{
$this->ExecuteQuery("Update ovenprofiles set ovenprofile_pdf_url = '' where ovenprofile_id=".$oven_profile_id);
$this->OvenProfileEdit();
}
}
}