Nicht mehr ganz neu hier
Hallo Ihr Lieben,
bitte um Eure Hilfe, habe meine Firmenabfrage nun mit weiteren Input-Felder ausgebaut und plötzlich funktioniert meine Blätterfunktion nicht mehr
// SEITEN BLAETTERN AUSGEBEN
Die Url wird aber richtig angezeigt, erst beim erneuten anklicken des Suchbuttons wird die zB. die 2. Seite gezeigt!
Habt Ihr einen Tipp? Danke & lg Mathi
bitte um Eure Hilfe, habe meine Firmenabfrage nun mit weiteren Input-Felder ausgebaut und plötzlich funktioniert meine Blätterfunktion nicht mehr
// SEITEN BLAETTERN AUSGEBENDie Url wird aber richtig angezeigt, erst beim erneuten anklicken des Suchbuttons wird die zB. die 2. Seite gezeigt!
Habt Ihr einen Tipp? Danke & lg Mathi
PHP:
<?php
// $seite DEFINIEREN
if(isset($_GET['seite'])){
$seite=strip_tags($_GET['seite']); // 'BÖSEN' CODE ENTFERNEN (strip_tags)
$seite=trim($seite); // ÜBERFLÜSSIGE LEERZEICHEN, TABS & CO VOR UND NACH DEM EIGENTLICHEN INHALT ENTFERNEN (trim)
}
else {
$seite=1;
}
// $seite DEFINIEREN ENDE
$ZeilenProSeite = 5; // ANZAHL EINTRÄGE PRO SEITE AUS DB
$start=$seite*$ZeilenProSeite-$ZeilenProSeite; // START FÜR LIMIT ($sql) BERECHENEN
// $suche DEFINIEREN
if(isset($_POST['s'])){
$suche=strip_tags($_POST['s']);
$suche=trim($suche);
}
else{
$suche='';
// HIER KÖNNTE MAN AUCH EINEN STANDARDWERT FESTLEGEN, ZUM BEISPIEL 'ALLE'
}
// $suche DEFINIEREN ENDE
?>
<div id="filter">
<table cellspacing="0" cellpadding="2" border="0" width="100%">
<form name="frm" id="frmSuche" method="post" action="">
<tbody border="1" bordercolor="#E1E1E1">
<tr>
<td><strong>Firmen</strong></td>
<td colspan="1" align="center"> <a href="eManager.php?page=firmaneu"><img border="0" src="images/neu.gif" alt="neue Firma"/></a><br/>
<a href="eManager.php?page=firmaneu">neue Firma</a>
</td>
</tr>
<tr>
<td align="center" colspan="4">
<input type="submit" value="ALLE" name="s"/>
<input type="submit" value="0-9" name="s"/><br />
<input type="submit" value="A" name="s"/>
<input type="submit" value="B" name="s"/>
<input type="submit" value="C" name="s"/>
<input type="submit" value="D" name="s"/>
<input type="submit" value="E" name="s"/>
<input type="submit" value="F" name="s"/>
<input type="submit" value="G" name="s"/>
<input type="submit" value="H" name="s"/>
<input type="submit" value="I" name="s"/>
<input type="submit" value="J" name="s"/>
<input type="submit" value="K" name="s"/>
<input type="submit" value="L" name="s"/>
<input type="submit" value="M" name="s"/>
<input type="submit" value="N" name="s"/>
<input type="submit" value="O" name="s"/>
<input type="submit" value="P" name="s"/>
<input type="submit" value="Q" name="s"/>
<input type="submit" value="R" name="s"/>
<input type="submit" value="S" name="s"/>
<input type="submit" value="T" name="s"/>
<input type="submit" value="U" name="s"/>
<input type="submit" value="V" name="s"/>
<input type="submit" value="W" name="s"/>
<input type="submit" value="X" name="s"/>
<input type="submit" value="Y" name="s"/>
<input type="submit" value="Z" name="s"/>
</td>
</tr>
</form>
<tr>
<td colspan="3">
<form id="suchen" method="POST" action="">
<label for="sucheFirma">Firma: </label><input type="text" value="" name="sucheFirma"/>
<label for="sucheStrasse">Strasse: </label><input type="text" value="" name="sucheStrasse"/>
<label for="suchePLZ">PLZ: </label><input type="text" value="" id="suchePLZ" name="suchePLZ"/>
<label for="sucheOrt">ORT: </label><input type="text" value="" name="sucheOrt"/>
<label for="sucheVorname">Ansprechperson: </label><input type="text" value="" name="sucheVorname"/><input type="text" value="" name="sucheNachname"/>
<select name="verkaeufer" size="1" id="verkaeufer" >
<option value="0">Verkäufer</option>
<?php
$sql = "SELECT id_Benutzer, nachname FROM tbl_benutzerdaten ORDER BY nachname ASC";
$result = mysql_query($sql) or die("ERROR: ".mysql_error());
while($data = mysql_fetch_array($result)){
echo '<option value="'.$data['id_Benutzer'].'">'.$data['nachname'].'</option>';
}
?>
</select>
<input type="submit" value="SUCHE" name="s"/>
</form>
</td>
<td align="right">
</td>
</tr>
</tbody>
</table>
<table border="0" cellpadding="0" cellspacing="0">
<colgroup>
<col width="30" />
<col width="200" />
<col width="200" />
<col width="200" />
<col width="50" />
<col width="100" />
<col width="100" />
</colgroup>
<thead>
<tr>
<th scope="col"></th>
<th scope="col">Firma</th>
<th scope="col">Ansprechperson</th>
<th scope="col">Adresse</th>
<th scope="col">PLZ</th>
<th scope="col">Ort</th>
<th scope="col">Telnr</th>
</tr>
</thead>
<?php
if($suche){
if($suche=='ALLE'){
$where=''; // ALLE DATENSÄTZE ANZEIGEN
}
elseif($suche=='0-9' || preg_match('/^[a-zA-Z]$/', $suche)){
$suche=strtoupper($suche);
$where=" WHERE Firma REGEXP '^[" . mysql_real_escape_string($suche) . "]'"; // DATENSÄTZE DIE MIT BUCHSTABE ODER ZAHL AUS $suche BEGINNEN
}
else{
$where=" WHERE Firma LIKE '%" . mysql_real_escape_string($_POST['sucheFirma']) . "%'
AND faStrasse LIKE '%" . mysql_real_escape_string($_POST['sucheStrasse']) . "%'
AND faPLZ LIKE '%" . mysql_real_escape_string($_POST['suchePLZ']) . "%'
AND faOrt LIKE '%" . mysql_real_escape_string($_POST['sucheOrt']) . "%'
AND faVorname LIKE '%" . mysql_real_escape_string($_POST['sucheVorname']) . "%'
AND faNachname LIKE '%" . mysql_real_escape_string($_POST['sucheNachname']) . "%'
";
if($_POST['verkaeufer']>0) { $where.= "AND fid_benutzer=".$_POST['verkaeufer'];}
}
// GESAMTANZAHL ERMITTELN
$sql = "SELECT COUNT(idFirma) FROM tbl_firmen" . $where;
$result = mysql_query($sql) or die("ERROR: ".mysql_error());
$anzahl = mysql_result($result, 0);
// GESAMTANZAHL ERMITTELN ENDE
if ($anzahl==0){
echo '<p class="Eintrag">Leider verlief die Suche ohne Erfolg!</p>';
}
else{
if ($anzahl==1){
echo '<p class="Eintrag">1 Eintrag gefunden</p>';
}
else{
echo '<p class="Eintrag">' . $anzahl . ' Einträge gefunden</p>';
}
$sql = "SELECT * FROM tbl_firmen" . $where . " ORDER BY Firma LIMIT " . $start . ", " . $ZeilenProSeite;
$result = mysql_query($sql) or die("ERROR: ".mysql_error());
if(mysql_num_rows($result)>=1){
echo '<tbody>';
$nr=1;
while($row = mysql_fetch_object($result)){
if($nr % 2 == 0 ){
$wert = 'bgFarbe1';
}
else{
$wert = 'bgFarbe2';
}
echo '
<form name="frmAnzeige" id="frmAnzeige" method="GET" action="fa_details.php">
<tr class="'.$wert.'">
<td align="center">'.($nr+$start).'</td>
<input type="hidden" name="idFirma" value="'.$row->idFirma.'" />
<td><a href="' . $_SERVER['PHP_SELF'] . '?page=fa_details&id='.$row->idFirma.'">'.$row->Firma.'</a></td>
<td>'.$row->faVorname.' '.$row->faNachname.'</td>
<td>'.$row->faStrasse.' '.$row->faHausnr.'</td>
<td>'.$row->faPLZ.'</td>
<td>'.$row->faOrt.'</td>
<td>'.$row->faTelVW.' '.$row->faTelNR.'</td>
</tr>
</form>
';
$nr++;
}
echo '</tbody>';
}
else{
echo '<p class="Eintrag">Seite ' . $seite . ' existiert nicht!</p>';
}
// SEITEN BLAETTERN AUSGEBEN
$gesamtseiten=ceil($anzahl/$ZeilenProSeite);
echo '<p class="link">Seite ';
for($i=1;$i<=$gesamtseiten;$i++){
if($i==$seite){
echo '<b>[' . $i . ']</b>';
}
else{
echo '[<a href="' . $_SERVER['PHP_SELF'] . '?page=firmen&seite=' . $i . '&s=' . $suche . '">' . $i . '</a>]';
}
}
echo '</p>';
// SEITEN BLAETTERN AUSGEBEN
}
}
else{
echo '<p class="Eintrag">Bitte geben Sie einen Suchbegriff ein!</p>';
}
?>
</tbody>
</table>
</div><!-- end filter -->
