+ Antworten
Ergebnis 1 bis 2 von 2

Thema: Problem mit if (isset....

  1. #1
    TP-Member veil macht alles soweit korrekt
    Registriert seit
    Aug 2009
    Beiträge
    53

    Problem mit if (isset....

    Hallo an alle,

    ich habe mir vor einigen tagen eine kleine suchabfrage in einer datenbank zusammengebastelt. Das ergebnis erscheint automatisch mit dem Laden der PHP Seite. Ich möchte aber gerne das Suchergebnis nur bei Klick auf einen Submit Button abfragen. Ich habe das mit if (isset( $_POST['eintragen'] ))
    {
    probiert aber ich weiss nicht wo ich das in den Code einfügen soll.

    Wenn ich es einfüge funktioniert die Suche nicht mehr oder es kommen Fehlermeldungen.

    Sagt mir jemand wo ich das einbinden müsste ?

    PHP-Code:
    <?php require_once('../Connections/Test.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 3;
    $pageNum_Recordset1 0;
    if (isset(
    $_GET['pageNum_Recordset1'])) {
      
    $pageNum_Recordset1 $_GET['pageNum_Recordset1'];
    }
    $startRow_Recordset1 $pageNum_Recordset1 $maxRows_Recordset1;

    mysql_select_db($database_Test$Test);
    $query_Recordset1 "SELECT * FROM mytable WHERE  mytable.vorname LIKE '%$airbag%' ORDER BY mytable.id DESC";
    $query_limit_Recordset1 sprintf("%s LIMIT %d, %d"$query_Recordset1$startRow_Recordset1$maxRows_Recordset1);
    $Recordset1 mysql_query($query_limit_Recordset1$Test) 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);

    $TFM_LimitLinksEndCount 2;
    $TFM_temp $pageNum_Recordset1 1;
    $TFM_startLink max(1,$TFM_temp intval($TFM_LimitLinksEndCount/2));
    $TFM_temp $TFM_startLink $TFM_LimitLinksEndCount 1;
    $TFM_endLink min($TFM_temp$totalPages_Recordset1 1);
    if(
    $TFM_endLink != $TFM_temp$TFM_startLink max(1,$TFM_endLink $TFM_LimitLinksEndCount 1);
    ?>
    <body>
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="formular" id="formular">
    <p>
      <input type="submit" name="eintragen" id="eintragen" value="Abschicken" />
      <input type="text" name="airbag" id="airbag" value="<?php $_POST['airbag'];?>"/>
    </p>
    <?php do { ?>
      <table width="181" height="88" border="0" cellpadding="0">
        <tr>
          <td width="155"><?php echo $row_Recordset1['vorname']; ?></td>
        </tr>
        <tr>
          <td><?php echo $row_Recordset1['alter']; ?></td>
        </tr>
          </table>
      <?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?><p>&nbsp;
      <?php
    for ($i=$TFM_startLink$i <= $TFM_endLink$i++) {
      
    $TFM_counter = ($i 1) * $maxRows_Recordset1 1;
      
    $TFM_endCounter min($totalRows_Recordset1,$TFM_counter $maxRows_Recordset1 1);
      if(
    $i-!= $pageNum_Recordset1) {
        
    printf('<a href="'."%s?pageNum_Recordset1=%d%s"$currentPage$i-1$queryString_Recordset1.'">');
          echo 
    "$TFM_counter-$TFM_endCounter</a>";
      }else{
        echo 
    "<strong>$TFM_counter-$TFM_endCounter</strong>";
      }
      if(
    $i != $TFM_endLink) echo "|";
    }
    ?></p>
    </body>
    </html>
    <?php
    mysql_free_result
    ($Recordset1);
    ?>

  2. #2
    TP-Specialist Master_T2 bringt sich richtig ein Master_T2 bringt sich richtig ein Avatar von Master_T2
    Registriert seit
    Oct 2002
    Ort
    Übach-Palenberg
    Beiträge
    2.272
    Ich vermute mal von dem Script hast du nichts selber geschrieben, oder? Andernfalls sollte es doch eine Leichtigkeit sein. Das was nach dem Submit aufgerufen werden soll muss halt in die Abfrage rein.
    Grüße aus Übach-Palenberg
    Tim

    http://www.template-shopping.de

+ Antworten

Ähnliche Themen

  1. Illegal offset type in isset or empty
    Von Netjunky im Forum Traum-Dynamik
    Antworten: 8
    Letzter Beitrag: 22.12.2008, 16:38
  2. if(isset($_POST[bla])) umgehen??
    Von StephanF im Forum Traum-Dynamik
    Antworten: 16
    Letzter Beitrag: 07.08.2006, 15:27
  3. Freehand MX: Userprep Problem und CMYK JPG Export Problem
    Von kethryl im Forum Layout- & Vektor-Programme
    Antworten: 3
    Letzter Beitrag: 07.05.2005, 11:52
  4. Antworten: 1
    Letzter Beitrag: 16.10.2004, 20:14
  5. submit Problem in isset funktion
    Von Paco im Forum Traum-Dynamik
    Antworten: 22
    Letzter Beitrag: 19.05.2003, 23:08

Stichworte

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

     

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51