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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
| <?php require_once('Connections/mylien.php'); ?>
<?php
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 scat (id_parent, nom) VALUES (%s, %s)",
GetSQLValueString($_POST['id_parent'], "double"),
GetSQLValueString($_POST['nom'], "text"));
mysql_select_db($database_mylien, $mylien);
$Result1 = mysql_query($insertSQL, $mylien) or die(mysql_error());
}
$colname_Recordset1 = "-1";
if (isset($_GET['id'])) {
$colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_mylien, $mylien);
$query_Recordset1 = sprintf("SELECT * FROM cat WHERE id = %s", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $mylien) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_mylien, $mylien);
$query_Recordset2 = "SELECT * FROM scat";
$Recordset2 = mysql_query($query_Recordset2, $mylien) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Document sans titre</title>
<style type="text/css">
<!--
.Style1 {
font-size: x-large;
font-weight: bold;
}
.Style2 {
color: #FF0000;
font-size: xx-large;
}
.Style3 {color: #FF0000}
-->
</style>
</head>
<body>
<div align="center" class="Style1">Ajout dans <span class="Style2"><?php echo $row_Recordset1['nom']; ?></span></div>
<p>Souscatégories déja présentent </p>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<table width="70%" border="0" align="center">
<tr>
<td width="18%">Nom</td>
<td width="82%">
<input name="nom" type="text" id="nom" size="70" maxlength="70" />
<input name="id_parent" type="hidden" value="<?php echo $row_Recordset1['id']; ?>" /></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit" value="Envoyer" />
</div></td>
</tr>
</table>
<input type="hidden" name="MM_insert" value="form1">
</form>
<p align="center"> </p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
mysql_free_result($Recordset2);
?> |
Partager