Hallo zusammen,
ich hoffe sehr, das Ihr mir helfen könnt. Ich habe ein Suchformular entwickelt.
Das Formular hat folgenden Code:
Das Formular macht, was es machen soll. Gebe ich z.B. "Muster" als Suchbegriff ein, werden die passenden Datensätze gefunden und angezeigt. Diese PHP habe ich nun in eine shtml includiert.
Hier ist der Code:
Mein Problem besteht darin, das dass includierte Formular in der shtml keine Daten mehr findet. Gebe ich also hier das Wort "Muster" ein, wird gar nichts gefunden. Ich hoffe, das mir einer von euch helfen kann und danke im voraus.
Gruß
Wernichtfragt
ich hoffe sehr, das Ihr mir helfen könnt. Ich habe ein Suchformular entwickelt.
Das Formular hat folgenden Code:
PHP-Code:
<?php require_once('../Connections/cc.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;
}
}
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$colname_Recordset1 = "-1";
if (isset($_POST['suchfeld1'])) {
$colname_Recordset1 = $_POST['suchfeld1'];
}
mysql_select_db($database_cc, $cc);
$query_Recordset1 = sprintf("SELECT * FROM kundenstamm WHERE Firma LIKE %s OR Plz LIKE %s OR Strasse LIKE %s OR Ort LIKE %s OR Bound LIKE %s", GetSQLValueString("%" . $colname_Recordset1 . "%", "text"),GetSQLValueString($colname_Recordset1 . "%", "text"),GetSQLValueString("%" . $colname_Recordset1 . "%", "text"),GetSQLValueString("%" . $colname_Recordset1 . "%", "text"),GetSQLValueString("%" . $colname_Recordset1 . "%", "text"));
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $cc) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
<style type="text/css">
<!--
body,td,th {
font-family: Arial, Helvetica, sans-serif;
font-size: 9pt;
}
.Stil1 {color: #CCCCCC}
body {
background-color: #EEEEEE;
}
-->
</style>
<label></label>
<form action="" method="post" enctype="application/x-www-form-urlencoded" name="form1" id="form1">
<table width="100%" border="0" align="center">
<tr>
<td width="114"><label>Suchbegriff</label></td>
<td width="147"> </td>
<td width="600"> </td>
</tr>
<tr>
<td><input name="suchfeld1" type="text" id="suchfeld1" value="<?php echo $_POST['suchtext']; ?>" /></td>
<td><label>
<input type="submit" name="senden" id="senden" value="suchen" />
</label></td>
<td> </td>
</tr>
</table>
<table width="100%" border="0" align="center">
<tr>
<td width="22%" bgcolor="#0066FF">Firma</td>
<td width="16%" bgcolor="#0066FF">Plz</td>
<td width="20%" bgcolor="#0066FF">Ort</td>
<td width="15%" bgcolor="#0066FF">Inbound/Outbound</td>
<td width="27%" bgcolor="#0066FF">Ansprechpartner</td>
</tr>
<?php do { ?>
<tr>
<?php if ($totalRows_Recordset1 > 0) { // Show if recordset not empty ?>
<td bgcolor="#F7F7F7"><a href="katalogdetail.php?recordID=<?php echo $row_Recordset1['id']; ?>"> <?php echo $row_Recordset1['Firma']; ?> </a> </td>
<td bgcolor="#8484FF"><?php echo $row_Recordset1['Plz']; ?> </td>
<td bgcolor="#F7F7F7"><?php echo $row_Recordset1['Ort']; ?> </td>
<td bgcolor="#8484FF"><label><?php echo $row_Recordset1['Bound']; ?></label></td>
<td bgcolor="#F7F7F7"><?php echo $row_Recordset1['Ansprechpartner']; ?></td>
<?php } // Show if recordset not empty ?>
</tr>
<tr>
<td height="20"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<p> </p>
<table border="0">
<tr>
<td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">Erster</a>
<?php } // Show if not first page ?>
</td>
<td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Zurück</a>
<?php } // Show if not first page ?>
</td>
<td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Vor</a>
<?php } // Show if not last page ?>
</td>
<td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Letzter</a>
<?php } // Show if not last page ?>
</td>
</tr>
</table>
Datensätze <?php echo ($startRow_Recordset1 + 1) ?> bis <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> von <?php echo $totalRows_Recordset1 ?>
</form>
<p> </p>
<p> </p>
<p> </p>
<?php
mysql_free_result($Recordset1);
?>
Das Formular macht, was es machen soll. Gebe ich z.B. "Muster" als Suchbegriff ein, werden die passenden Datensätze gefunden und angezeigt. Diese PHP habe ich nun in eine shtml includiert.
Hier ist der Code:
PHP-Code:
<!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>Die Callcenter Knowledge base</title>
<script type="text/javascript" src="Pluginlab/Scripts/PLHFO.js">/* PLHFOMenu script */</script>
</head>
<body onload="PLHFO_onload()">
<div id="aussen">
<div id="navi"></div>
<div id="cckatalog">
<div class="Stil5" id="headline1">Callcenter Katalog </div>
<div id="dekoline1"></div>
<div id="innercontentoben"></div>
<div id="ccserachtable">
<!--#include file="katalog.php" -->
</div>
</div>
<div id="googleadver">
<script type="text/javascript"><!--
google_ad_client = "pub-*************";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "336699";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<div id="leftnavi">
<!--#include virtual="/navigation/navigation.php" -->
</div>
</div>
</body>
</html>
Gruß
Wernichtfragt
Kommentar