codice:
<?php require_once('Connections/sementiero.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 = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO questionario (nome, localita, sede, costitutore, moltiplicatore, tipologia, res, viv, mi, me, cf, fa1, fb1, fc1, fa2, fb2, fc2, fa3, fb3, fc3, fa4, fb4, fc4, fa5, fb5, fc5, fa6, fb6, fc6, fa7, fb7, fc7, fa8, fb8, fc8, fa9, fb9, fc9, dm1, dp1, dm2, dp2, dm3, dp3, dm4, dp4, dp5, pf, us, uf, cm, hm, ap1, a1, ap2, a2, ap3, a3, ap4, a4, a5, r1, ra1, r2, ra2, r3, ra3, r4, ra4, r5, ra5, r6, ra6, r7, ra7, r8, ra8, r9, ra9) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['nome'], "text"),
GetSQLValueString($HTTP_POST_VARS['localita'], "text"),
GetSQLValueString($HTTP_POST_VARS['sede'], "text"),
GetSQLValueString(isset($HTTP_POST_VARS['costitutore']) ? "true" : "", "defined","1","0"),
continua taglio per semplificare .....
mysql_select_db($database_sementiero, $sementiero);
$Result1 = mysql_query($insertSQL, $sementiero) or die(mysql_error());
$insertGoTo = "q2.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<html>
<body>
<form action="" method="POST" name="form1" target="_self">
continua...