Newsgroup: it.comp.www.php
Titolo: Non visualizzo dati dal DB

Ciao a tutti,
non riesco a visualizzare i dati richiesti da un form sulla pagina ciao.php.
Qualcuno mi puï¿œ cortesemente aiutare?
 
 
 
pagina_record.php :
 
<title>Documento senza titolo</title>
</head>
 
<body>
<form id="form" name="form" method="post" action="ciao.php">
   <label>cerca
   <input type="text" name="cerca" id="cerca" />
   </label>
   <label>
   <input type="submit" name="invia" id="invia" value="Invia" />
   </label>
</form>
<p>&nbsp;</p>
</body>
</html>
 
 
pagina ciao.php :
 
<?php require_once('Connections/conn_db.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", 
$theNotDefinedValue = "")
{
   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
   $theValue = function_exists("mysql_real_escape_string") ? 
mysql_real_escape_string($theValue) : mysql_escape_string($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;
}
}
 
$colname_telefoni = "-1";
if (isset($_POST['form'])) {
   $colname_telefoni = $_POST['form'];
}
mysql_select_db($database_conn_db, $conn_db);
$query_telefoni = sprintf("SELECT * FROM sheet1 WHERE INTERNO = %s", 
GetSQLValueString($colname_telefoni, "int"));
$telefoni = mysql_query($query_telefoni, $conn_db) or die(mysql_error());
$row_telefoni = mysql_fetch_assoc($telefoni);
$totalRows_telefoni = mysql_num_rows($telefoni);
?><!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=utf-8" />
<title>Documento senza titolo</title>
</head>
 
<body>
<?php echo $row_telefoni['SEDE']; ?>
<?php echo $row_telefoni['COGNOME']; ?>
<?php echo $row_telefoni['NOME']; ?>
<?php echo $row_telefoni['INTERNO']; ?>
<?php echo $row_telefoni['CRIS']; ?>
<?php echo $row_telefoni['CPL']; ?>
<?php echo $row_telefoni['POS']; ?>
</body>
</html>
<?php
mysql_free_result($telefoni);
?>
 
 
 


 
IMHO non leggi $_POST['invia'] e $_POST['cerca']
 


Grazie 1000.
Mi puoi aiutare gentilmente nel caso invece dovessi avere più campi di 
ricerca?
 
<title>Documento senza titolo</title>
</head>
 
<body>
<form id="form" name="form" method="post" action="ciao.php">
   <label>cerca
   <input type="text" name="cerca1" id="cerca" />
   </label>
   <label></label>
     <label><br />
     cerca
   <input type="text" name="cerca2" id="cerca" />
   </label>
    <label><br />
     cerca
   <input type="text" name="cerca2" id="cerca" />
   </label>
     <label>
      <label><br />
     cerca
   <input type="text" name="cerca3" id="cerca" />
   </label>
    <label><br />
     cerca
   <input type="text" name="cerca4" id="cerca" />
   </label>
    <label><br />
     cerca
   <input type="text" name="cerca5" id="cerca" />
   </label>
    <label><br />
     cerca
   <input type="text" name="cerca6" id="cerca" />
   </label>
    <label><br />
     cerca
   <input type="text" name="cerca7" id="cerca" />
   </label> <label><br />
     cerca
   <input type="text" name="cerca8" id="cerca" />
   </label> <label><br />
     cerca
   <input type="text" name="cerca9" id="cerca" />
   </label> <label><br />
     cerca
   <input type="text" name="cerca10" id="cerca" />
   </label> <label><br />
     cerca
   <input type="text" name="cerca11" id="cerca" />
   </label> <label><br />
     cerca
   <input type="text" name="cerca12" id="cerca" />
   </label> <label><br />
     cerca
   <input type="text" name="cerca13" id="cerca" />
   </label> <label><br />
     cerca
   <input type="text" name="cerca14" id="cerca" />
   </label>
    <label><br />
     cerca
   <input type="text" name="cerca15" id="cerca" />
   </label>
 
   <input type="submit" name="cerca15" id="invia" value="Invia" />
   </label>
 
</form>
<p>&nbsp;</p>
</body>
</html>
 
=========================================================

if (isset($_POST['cerca2'])) {
   $colname_telefoni = $_POST['cerca2'];
 
}
mysql_select_db($database_conn_db, $conn_db);
$query_telefoni = sprintf("SELECT * FROM sheet1 WHERE INTERNO = %s", 
GetSQLValueString($colname_telefoni, "int"));
$telefoni = mysql_query($query_telefoni, $conn_db) or die(mysql_error());
$row_telefoni = mysql_fetch_assoc($telefoni);
$totalRows_telefoni = mysql_num_rows($telefoni);
?><!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=utf-8" />
<title>Documento senza titolo</title>
<style type="text/css">
<!--
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #FFFFFF;
}
body {
	background-color: #000000;
}
-->
</style></head>
 
<body>
<table width="983" border="1">
   <tr>
     <td width="123">SEDE</td>
     <td width="132">COGNOME</td>
     <td width="104">NOME</td>
     <td width="123">INTERNO</td>
     <td width="97">CRIS</td>
     <td width="91">CPL</td>
     <td width="93">POS</td>
     <td width="76">COPPIA</td>
     <td width="86">PRESA</td>
   </tr>
   <tr>
     <td><?php echo $row_telefoni['SEDE']; ?></td>
     <td><?php echo $row_telefoni['COGNOME']; ?></td>
     <td><?php echo $row_telefoni['NOME']; ?></td>
     <td><?php echo $row_telefoni['INTERNO']; ?></td>
     <td><?php echo $row_telefoni['CRIS']; ?></td>
     <td><?php echo $row_telefoni['CPL']; ?></td>
     <td><?php echo $row_telefoni['POS']; ?></td>
     <td><?php echo $row_telefoni['1A-COPPIA']; ?></td>
     <td><?php echo $row_telefoni['NUMERO PRESA']; ?></td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
   <tr>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
   </tr>
</table>
