grazie Andrea1979
mi sto documentando, spero di risolvere.
codice:
<?php require_once('../Connections/connessione.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"] == "insNews")) {
$insertSQL = sprintf("INSERT INTO news_articles (subject, message, `date`) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['subject'], "text"),
GetSQLValueString($_POST['message'], "text"),
GetSQLValueString($_POST['date'], "text"));
mysql_select_db($database_unifarm, $unifarm);
$Result1 = mysql_query($insertSQL, $unifarm) or die(mysql_error());
$insertGoTo = "list_News.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
virtual('../Connections/unifarm.php'); ?>
<!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>Inserisci nuova news</title>
<link href="stileadmin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div align="center">[img]/test/img_head/03.jpg[/img] </div>
<div id="lista">
<h1>Inserisci nuova news:</h1>
<form action="<?php echo $editFormAction; ?>" id="insNews" name="insNews" method="POST">
<table border="0" cellpadding="2" cellspacing="2">
<tr>
<td width="8%" valign="top">
Data:</p></td>
<td width="92%">
<input name="date" type="text" id="date" />
gg/mm/aaaa</p></td>
</tr>
<tr>
<td valign="top">
Titolo:</p></td>
<td><label>
<input name="subject" type="text" id="subject" />
</label></td>
</tr>
<tr>
<td valign="top">
Testo:</p></td>
<td><label>
<textarea name="message" cols="40" rows="15" id="message"></textarea>
</label></td>
</tr>
<tr>
<td></td>
<td>
<a href="javascript:history.back()" class="tasto"> Torna indietro
</a>
<input class="tasto" type="submit" name="Submit" value="Inserisci" /> </td>
</tr>
</table>
</p>
<a href="menu.php">
</a>
<input type="hidden" name="MM_insert" value="insNews">
</p>
</form></div>
</body>
</html>