pdf in pop up wie werte über button übergeben?

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • pdf in pop up wie werte über button übergeben?

    Hi an alle,

    Ich hab erst angefangen mit php zu arbeiten und stehe grad vor einem Problem. Und zwar möchte ich eine ID aus meiner SQL Datenbank an die test.php übergeben und jeweils dann bei Button Klick ein pdf mit Hilfe dieser ID generieren.

    Hoffe das war verständlich

    Hier mein Code
    PHP-Code:
    <?php
    include "connect.inc_orginal.php";

    $res mysql_query("select e.id , e.titel, e.kategorie, e.semester, b.telefon, b.email, b.einrichtung, b.campus from expose as e, betreuer as b where e.betreuer_id = 1");
    $num mysql_num_rows($res);

    //Tabellenbegin
    //echo "<table border='10'>";

    //Farben festlegen:
    $color1 "#f0f0f0";
    $color2 "white";
    $color3 "#666666";
    //Hilfsvariablen:
    $background 0;
    $backgroundColor ""

    echo 
    "<table cellpadding='3' cellspacing='3'  border='0' width='100%'>";
    //Überschrift color #666666
    echo " <td><font color=$color3><b>Nr</b></td> <td><font color=$color3>
    <b>Thema</b></td> <td><font color=
    $color3><b>Kategorie</b></td> <td>
    <font color=
    $color3><b>Einrichtung</b></td> <td><font color=$color3><b>Standort
    </b></td> <td><font color=
    $color3><b>Semester</b></td><td><font color=$color3>
    <b>Telefon</b></td><td><font color=
    $color3><b>Email</b></td></tr>";

    $i=0;
    while (
    $dsatz mysql_fetch_assoc($res))
    {
        
    //Überprüfen, welchen Wert $background hat
                    
    switch ($background)
                    {
                        case 
    0:  $backgroundColor $color1; break;
                        case 
    1:  $backgroundColor $color2; break;
                    } 
      

      

        echo 
    "<td  style='background-color: " $backgroundColor ";' >" $dsatz["id"] . "</td>";
        
        echo 
    "<td  style='background-color: " $backgroundColor ";' >" $dsatz["titel"] . "</td>";
        echo 
    "<td  style='background-color: " $backgroundColor ";' >" $dsatz["kategorie"] . "</td>";
        echo 
    "<td  style='background-color: " $backgroundColor ";' >" $dsatz["einrichtung"] . "</td>";
        echo 
    "<td  style='background-color: " $backgroundColor ";' >" $dsatz["campus"] . "</td>";
        echo 
    "<td  style='background-color: " $backgroundColor ";' >" $dsatz["semester"] . "</td>";
        echo 
    "<td  style='background-color: " $backgroundColor ";' >" $dsatz["telefon"] . "</td>";
        echo 
    "<td  style='background-color: " $backgroundColor ";' >" $dsatz["email"] . "</td>";
        
      echo 
    "<td> <input type=\"button\" value=\"PDF\"  name=\"$dsatz\"  onClick=\"window.open('test.php?id=$dsatz', 'Name','toolbar=no,status=no,menubar=no,width=400,height=400')\"></td>";
        echo 
    "</tr>";
      
    $i++;
     
    //$background umkehren
          
    $background = !$background
    }

    //Tabellenende
    echo "</table>";
    ?>
    Vielen Dank schonmal für die Hilfe

  • #2
    erstmal Code umbrechen!!!
    desweiteren übergibst du momentan an die test.php gleich das ganze Array, was so nicht funktioniert, entweder du übergibst nur
    $dsatz['id']
    oder du hängst alle Parameter an die URL dran

    Kommentar


    • #3
      Hm also ich hab jetzt folgendes versucht (und auch alle anderen Varianten, die mir eingefallen sind):

      PHP-Code:
      echo "<td> <input type=\"button\" value=\"PDF\"  name=\"$dsatz\"  onClick=\"window.open('test.php?id=$dsatz['id']', 
      'Name','toolbar=no,status=no,menubar=no,width=400,height=400')\">
      </td>"

      dann kommt ein Parse Error:

      Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in
      Zuletzt geändert von wandasia; 11.12.2007, 18:23.

      Kommentar


      • #4
        Sorry es klappt.

        Ist es besser mehr parameter zu übergeben oder einfach neu die SQL anfrage auszuführen?

        Kommentar


        • #5
          letzteres
          ICH BIN ICH!!!

          Kommentar

          Lädt...
          X