|
|
PHP Quellcode |
1 2 3 4 5 6 7 8 |
<?php echo '<select name="bundesland">'; $result = mysql_query("SELECT title,text FROM `inhalte` WHERE `gruppe` = '$_GET[s]'; "); while($row = mysql_fetch_object($result)) { echo '<option value="'.$row->title.'">'.$row->title.'</option>'; } echo '</select>'; ?> |
|
|
JavaScript Code |
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 |
<script type="text/Javascript"> <!-- function sendRequest() { try { req = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { //Kein AJAX Support } req.onreadystatechange = handleResponse; id = document.getElementById('berufsgruppe').value; req.open('get', 'func.php?s='+ id); req.send(null); } function handleResponse() { if ((req.readyState == 4) && (req.status == 200)) { document.getElementById('inhalt').innerHTML = req.responseText; } } //--> </script> |
|
|
PHP Quellcode |
1 2 3 4 5 6 7 8 9 10 11 |
<?php include "action/verb.php"; //Inhalte laden $result = mysql_query("SELECT * FROM berufe WHERE gruppe = '$_GET[s]'") or die(mysql_error()); while($row = mysql_fetch_object($result)) { $beruf = $row->bezeichnung; echo "<option value=\"".$beruf."\">".$beruf."</option>"; } ?> |
|
|
HTML Code |
1 2 3 |
<select id="inhalt" class="form" name="beruf"> </select> |
Quoted from ""Maverick1611""
Im Mozilla funktioniert das auch, aber leider nicht im IE6.
|
|
JavaScript Code |
1 |
req.open('get', 'func.php?s='+ id + '&anti_cache=' + Math.random()); |

Dann ist es das selbe wie im Thread nur mit mehr Logik und ohne Ausgabe
Wo hakt es denn?
Also im Grunde brauche ich: Nicht die erste Datenbankabfrage sollte eine Ausgabe bringen, sondern erst die 2.Mein Problem bisher:
Sobald ich die erste Datenbankabfrage ausführe, möchte er alles, was in der folgenden While-Schleife vorkommt, schon zurückliefern. Alles danach (2. Datenbankabfrage, usw.) interessiert ihn nicht mehr.
|
|
Source code |
1 2 3 4 5 6 7 8 |
$allObjectArts = explode (',',$_POST['objectType']);
$result = mysql_query("SELECT * FROM isz1_1_object_arts");
while($row = mysql_fetch_object($result))
{
if(in_array($row['itemID'], $allObjectArts)) {
echo '<option value="0">test</option>';
}
}
|
|
|
Source code |
1 |
echo '<option value="'.$row->itemID.'">'.$row->itemName.'</option>'; |
|
|
Source code |
1 |
echo '<option value="'.$row->itemID.'">{lang}'.$row->itemName.'{/lang}</option>';
|