This is the code at the top of my page:
<?php
include "dbc_script.inc";
include "rep_script.inc";
if ($Submit) {
//regrouping variables in one
$rep_zip=$rep_zip1 . '-' . $rep_zip2;
$rep_bphone=$rep_bphone1 . '-' . $rep_bphone2 . '-' . $rep_bphone3;
$rep_hphone=$rep_hphone1 . '-' . $rep_hphone2 . '-' . $rep_hphone3;
$rep_cphone=$rep_cphone1 . '-' . $rep_cphone2 . '-' . $rep_cphone3;
// process form by calling a function
rep_register($rep_id,$rep_fname,$rep_lname,$rep_address,$rep_suite,$rep_city,$rep_state,$rep_zip,$rep_country,$rep_bphone,$rep_bphonex,$rep_hphone,$rep_cphone,$rep_email,$rep_uname,$rep_pword,$rep_rpword);
} else{
// display form
?>
And this is the funciton that I'm calling from the outside file:
function rep_register($rep_id,$rep_fname,$rep_lname,$rep_address,$rep_suite,$rep_city,$rep_state,$rep_zip,$rep_country,$rep_bphone,$rep_bphonex,$rep_hphone,$rep_cphone,$rep_email,$rep_uname,$rep_pword,$rep_rpword) {
/*
* fuction to register a new sales rep. in the database
*/
global $companyEmail,$hidden_hash_var,$errbody,$errfooter,$rep_confPath,$rep_loginPath;
//Checking if all vars are present and passwords match
if ($rep_id && $rep_fname && $rep_lname && $rep_address && $rep_city && $rep_state && $rep_zip && $rep_country && $rep_bphone && $rep_email && $rep_uname && $rep_pword && $rep_rpword) {
//Here i'll update the database with other functions, if OK.
} else {
$errmessage .="ERREUR - Faut bien remplir les champs obligatoires.";
echo $errbody . $errmessage . $errfooter;
}
}