0){ unset($sendchange); // unset if email address is already in system $userexists = true; } } // If All Form fields are good, submit if($sendchange){ /* ============================================ */ /* [S] Manipulate Form Entries As Needed */ /* Add what you need here (pre-db submission) */ /* ============================================ */ // Strip HTML from vars, replace [return] with
while(list($var,$value) = each($_POST)){ $_POST[$var] = strip_tags($value, ''); } if ($_POST[graduated_programs]){ $_POST[graduated_programs] = implode(",", $graduated_programs); $_POST[graduated_programs] = ',' . $_POST[graduated_programs] . ','; } // Convert email string to lower case if ($_POST[email]){ $_POST[email] = strtolower($_POST[email]); } /* ============================================ */ /* [E] Manipulate Form Entries As Needed */ /* ============================================ */ // Get List Of DB Fields, Auto-Populate with like form values. Skip fields marked 'id' $fields = db_exec_sql("SELECT * FROM $db_dbtable LIMIT 1","$db_database"); $columns = mysql_num_fields($fields); for ($i = 0; $i < $columns; $i++) { $fieldname = mysql_field_name($fields, $i); if($fieldname != "$db_idfield"){$sqltext .= "$fieldname = '$_POST[$fieldname]',";} } // Build Correct SQL Statement depending on POST mode $sqltext = substr($sqltext,0,-1); // Strip last comma off if( ($_POST['submitmode'] == "edit") ){$sql = "UPDATE $db_dbtable SET $sqltext WHERE $db_idfield = '$_POST[editid]'";} // Update Mode if( ($_POST['submitmode'] == "add") ){$sql = "INSERT INTO $db_dbtable SET $sqltext"; $recip = "efoy@leadershipteacher.org"; //$recip = "david@wedu.com"; //$recip = "kimball@wedu.com"; //$debug = true; mail($recip, "Teacher's Toolbox Submission", "A new entry has been added to the Teacher's Toolbox. To view the toolbox entries, go to: \n\n \n\nNote: You must be logged in to view this link.", "From: Leadership Teacher \nX-Mailer: PHP/" . phpversion(). "/qmail"); } // Insert Mode // Fire Away, return results if($debug){echo "\r\n\r\n\r\n\r\n\r\n\r\n";} // show SQL in comments in debug mode $sql_action = db_exec_sql($sql,$db_database); if($sql_action){ // Show message on success ?>
Success:
Your lesson plan has been sent successfully. Your entry will be reviewed for content by a moderator within the next 24 hours.


Error:
An unknown error has occurred.
Error:
This email address already exists in our system. Please enter a unique email address then try again.


Error:
There was an error with your submission. Please be sure that all required fields marked below are complete, then try again.



','
'), "\r", stripslashes($value)); } // ================================ // // [S] Add Your Form Here // // ================================ // ?>
Lesson Plan Details
Please complete all required fields [*] below.
* Title: