Hallo alle zusammen
ich habe ein ausleseformular erstellt, bei dem der user spezifische details angeben kann und dann die dem entsprechenden daten ausgelesen bekommt.
nadem ich den submit button betätige bekomme ich die Daten korrekt ausgelesen, sobald ich dann aber auf den next link drücke bekomme ich nur undefined index der postvariable.
woran könnte das liegen.
<?php
// DB connect **********************************************************************************************************
error_reporting(E_ALL);
// Database Connection
include "inc/db_config.inc.php";
$db_link = @mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS) OR die(mysql_error());
mysql_select_db(MYSQL_DATABASE) OR die(mysql_error());
$bundesland = " ";
$landkreis = " ";
$stadt = " ";
$arbeitsbereich = " ";
//if ($_POST){
$bundesland = $_REQUEST['bundesland'];
$landkreis = $_POST['landkreis'];
$stadt = $_POST['stadt'];
$arbeitsbereich = $_POST['arbeitsbereich'];
//}
/*Headpart */
@include "inc/headpart.inc.php";
?>
<?php // Suchformular anfang **********************************************************************************************************+
/*suchformular */
@include "inc/suchformular.inc.php";
?>
</td></tr>
<tr><td>
<?php
// define variables *********************************************************************************************
// If current page number, use it
// if not, set one!
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
// Define the number of results per page
$max_results = 7;
// Figure out the limit for the query based
// on the current page number.
$from = (($page * $max_results) - $max_results);
// Perform MySQL query on only the current page number's results
$sDetails[] = "BD_bundesland";
$sDetails[] = "BD_landkreis";
$sDetails[] = "BD_ort";
$sDetails[] = "BD_type";
$suchwert[] = $bundesland;
$suchwert[] = $landkreis;
$suchwert[] = $stadt;
$suchwert[] = $arbeitsbereich;
$items = mysql_result(mysql_query("SELECT COUNT(BD_Datum)as Num FROM bauherren_daten WHERE ".$sDetails[1]."
LIKE '".$suchwert[1]."%' "),0);
$i = 1;
$bgcolor = " ";
$scountP = 0;
$CP = 1;
echo "<br>";
echo("<table align=\"center\" width=\"610\" border=\"0\" cellspacing=\"1\">");
foreach($sDetails as $value){
// echo $sDetails[$scountP]." ist ".$value."<br>";
$sql = "SELECT BD_text, BD_Datum FROM `bauherren_daten` WHERE ".$sDetails[$scountP]."
= '".$suchwert[$scountP]."' ORDER BY `BD_ID` DESC LIMIT $from, $max_results ";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
if ($bgcolor == "#DBDEB1"){
$bgcolor = "#FFFFFF";
}else{
$bgcolor = "#F0F3C4";
}
$datumP = $row['BD_Datum'];
$textP = $row['BD_text'];
$datenP[$CP] = $datumP;
$datenTP[$CP] = $textP;
//echo "Output ".$CP." ist: ".$datenP[$CP].", ".$datenTP[$CP]."<br>";
echo "<tr bgcolor=".$bgcolor.">";
echo "<td width=\"100\" class=\"Stil1\" scope=\"col\"><div align=\"left\">Angebot ".$CP.":</div></td>";
echo "<td width=\"110\" scope=\"col\"><div align=\"left\"> ".$datenP[$CP]."</div></td>";
echo "<td width=\"400\" scope=\"col\"><div align=\"left\">".$datenTP[$CP]."</div></td>";
echo "<td ><a href=\"login.php\">Interessiert ? </a> </td>";
echo "</tr>";
$CP++;
}
$scountP++;
$i++;
}
echo("</table>");
echo "<br>".$items;
// Figure out the total number of results in DB:
$total_results = $items;
//$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM bauherren_daten "),0);
//$total_results = $scountP-1;
// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);
?>
</td></tr>
<tr><td bgcolor="#DBDEB1" scope="col"><span class="Stil8">
<?php
// Build Page Number Hyperlinks
echo "<center>Select a Page<br />";
// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><< Zurueck</a> ";
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}
// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo " <a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Weiter>></a>";
}
echo "</center>";
?>
</span>
<?php
/* Footpart */
@include "inc/footpart.inc.php";
?>
ich habe ein ausleseformular erstellt, bei dem der user spezifische details angeben kann und dann die dem entsprechenden daten ausgelesen bekommt.
nadem ich den submit button betätige bekomme ich die Daten korrekt ausgelesen, sobald ich dann aber auf den next link drücke bekomme ich nur undefined index der postvariable.
woran könnte das liegen.
<?php
// DB connect **********************************************************************************************************
error_reporting(E_ALL);
// Database Connection
include "inc/db_config.inc.php";
$db_link = @mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS) OR die(mysql_error());
mysql_select_db(MYSQL_DATABASE) OR die(mysql_error());
$bundesland = " ";
$landkreis = " ";
$stadt = " ";
$arbeitsbereich = " ";
//if ($_POST){
$bundesland = $_REQUEST['bundesland'];
$landkreis = $_POST['landkreis'];
$stadt = $_POST['stadt'];
$arbeitsbereich = $_POST['arbeitsbereich'];
//}
/*Headpart */
@include "inc/headpart.inc.php";
?>
<?php // Suchformular anfang **********************************************************************************************************+
/*suchformular */
@include "inc/suchformular.inc.php";
?>
</td></tr>
<tr><td>
<?php
// define variables *********************************************************************************************
// If current page number, use it
// if not, set one!
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
// Define the number of results per page
$max_results = 7;
// Figure out the limit for the query based
// on the current page number.
$from = (($page * $max_results) - $max_results);
// Perform MySQL query on only the current page number's results
$sDetails[] = "BD_bundesland";
$sDetails[] = "BD_landkreis";
$sDetails[] = "BD_ort";
$sDetails[] = "BD_type";
$suchwert[] = $bundesland;
$suchwert[] = $landkreis;
$suchwert[] = $stadt;
$suchwert[] = $arbeitsbereich;
$items = mysql_result(mysql_query("SELECT COUNT(BD_Datum)as Num FROM bauherren_daten WHERE ".$sDetails[1]."
LIKE '".$suchwert[1]."%' "),0);
$i = 1;
$bgcolor = " ";
$scountP = 0;
$CP = 1;
echo "<br>";
echo("<table align=\"center\" width=\"610\" border=\"0\" cellspacing=\"1\">");
foreach($sDetails as $value){
// echo $sDetails[$scountP]." ist ".$value."<br>";
$sql = "SELECT BD_text, BD_Datum FROM `bauherren_daten` WHERE ".$sDetails[$scountP]."
= '".$suchwert[$scountP]."' ORDER BY `BD_ID` DESC LIMIT $from, $max_results ";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
if ($bgcolor == "#DBDEB1"){
$bgcolor = "#FFFFFF";
}else{
$bgcolor = "#F0F3C4";
}
$datumP = $row['BD_Datum'];
$textP = $row['BD_text'];
$datenP[$CP] = $datumP;
$datenTP[$CP] = $textP;
//echo "Output ".$CP." ist: ".$datenP[$CP].", ".$datenTP[$CP]."<br>";
echo "<tr bgcolor=".$bgcolor.">";
echo "<td width=\"100\" class=\"Stil1\" scope=\"col\"><div align=\"left\">Angebot ".$CP.":</div></td>";
echo "<td width=\"110\" scope=\"col\"><div align=\"left\"> ".$datenP[$CP]."</div></td>";
echo "<td width=\"400\" scope=\"col\"><div align=\"left\">".$datenTP[$CP]."</div></td>";
echo "<td ><a href=\"login.php\">Interessiert ? </a> </td>";
echo "</tr>";
$CP++;
}
$scountP++;
$i++;
}
echo("</table>");
echo "<br>".$items;
// Figure out the total number of results in DB:
$total_results = $items;
//$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM bauherren_daten "),0);
//$total_results = $scountP-1;
// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);
?>
</td></tr>
<tr><td bgcolor="#DBDEB1" scope="col"><span class="Stil8">
<?php
// Build Page Number Hyperlinks
echo "<center>Select a Page<br />";
// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><< Zurueck</a> ";
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}
// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo " <a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Weiter>></a>";
}
echo "</center>";
?>
</span>
<?php
/* Footpart */
@include "inc/footpart.inc.php";
?>