1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO etudiant (nom, prenom, promotion, mail, tel, info) VALUES (%s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['nom'], "text"),
GetSQLValueString($_POST['prenom'], "text"),
GetSQLValueString($_POST['promotion'], "text"),
GetSQLValueString($_POST['mail'], "text"),
GetSQLValueString($_POST['tel'], "text"),
GetSQLValueString($_POST['info'], "text"));
mysql_select_db($database_ConnexionStages, $ConnexionStages);
$Result1 = mysql_query($insertSQL, $ConnexionStages) or die(mysql_error());
$insertSQL = sprintf("INSERT INTO stage1a (societe, adresse, ville, departement, pays, tel, fax, datedebut, datefin, maitre, theme, tuteur, confidentialite, info) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) ",
GetSQLValueString($_POST['societe1A'], "text"),
GetSQLValueString($_POST['adresse1A'], "text"),
GetSQLValueString($_POST['ville1A'], "text"),
GetSQLValueString($_POST['dep1A'], "text"),
GetSQLValueString($_POST['pays1A'], "text"),
GetSQLValueString($_POST['tel1A'], "text"),
GetSQLValueString($_POST['fax1A'], "text"),
GetSQLValueString($_POST['datedebut1A'], "text"),
GetSQLValueString($_POST['datefin1A'], "text"),
GetSQLValueString($_POST['maitre1A'], "text"),
GetSQLValueString($_POST['theme1A'], "text"),
GetSQLValueString($_POST['tuteur1A'], "text"),
GetSQLValueString($_POST['confidentialite1A'], "text"),
GetSQLValueString($_POST['info1A'], "text")); |
Partager