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
	
Vielen Dank schonmal für die Hilfe
							
						
					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>";
?>
 
          
Kommentar