Mam napisany skrypt wyboru kategorii (coś ala jak na allegro przy wystawianiu aukcji.), jednak ostatnia 3 (modele.php) pozycja nie przekazuje mi wartości z pola (option).
Skrypt wygląda tak:
Index.php
<form action="index.php?co=sprawdz" method="POST"> <tr><td width="150px">Wybierz kategorie</td> <td width="40px"> <?php echo " <select name=\"cid\" onchange=\"ajaxFunction2()\" id=\"cid\" width=\"15\">" ."<option value=\"\">--Typ--</option>"; $tytul = $row['NazwaK']; } ?> <td width="40px"> <div id='ajaxDiv2'></div> </td> <td width="40px"> <div id='ajaxDiv'></div> </td> </tr> <?php if($_GET[co]=='dodaj'){ } ?>
marki.php
<?php $cid = $_GET['cid']; $dropdown = "<select name=\"mid\" id=\"mid\" width=\"15\" onchange=\"ajaxFunction()\">"; $dropdown .= "<option value=\"\">--Marka--</option>"; $result2 = mysql_query("SELECT * FROM kategorie WHERE PodKategoria='".$cid."' ORDER BY `IdK` DESC"); $marka = $row['NazwaK']; $dropdown .= "<option value=\"".$mid."\">".$marka."</option>"; } $dropdown .= "</select><br>"; } ?>
modele.php
<?php $mid = $_GET['mid']; $dropdown = "<select name=\"model\" id=\"model\" width=\"15\">"; $dropdown .= "<option value=\"\">--Model--</option>"; $result2 = mysql_query("SELECT * FROM kategorie WHERE PodKategoria='".$mid."' ORDER BY `IdK` DESC"); $model = $row['NazwaK']; $dropdown .= "<option value=\"".$id."\">".$model."</option>"; } $dropdown .= "</select><br>"; } ?>
ajax.js
function ajaxFunction(){ var ajaxRequest; try{ ajaxRequest = new XMLHttpRequest(); } catch (e){ try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser broke!"); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ajaxDiv'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var mid = document.getElementById('mid').value; var queryString = "?mid=" + mid; ajaxRequest.open("GET", "modele.php" + queryString, true); ajaxRequest.send(null); } function ajaxFunction2(){ var ajaxRequest; // magic variable try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Receive Data Function ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ajaxDiv2'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var cid = document.getElementById('cid').value; var queryString = "?cid=" + cid; ajaxRequest.open("GET", "marki.php" + queryString, true); ajaxRequest.send(null); }
Jeżeli jest osoba która może mi w tym pomóc, to bardzo był bym wdzięczny.
Dziękuje i Pozdrawiam
Nie ma osoby na tym forum, która była by mi w stanie pomóc

Pozdrawiam