L34L Posted May 29, 2008 Share Posted May 29, 2008 Here we go: Two dynamic JumpMenu must be created through a MySQL query and this works for me: _____________________________________________________________________________________________________________________ $sql="SELECT DISTINCT marca FROM marcas where codigo like 'K%' order by marca"; $result = mysql_query($sql, $conexio); $marca=$_GET["marca"]; if ($marca) { $m=$marca; } else { $m="ALCATEL";} $sql1="SELECT DISTINCT modelo FROM marcas where precio != 0 and codigo like 'K%' and marca='".$m."' order by modelo"; $result1 = mysql_query($sql1, $conexio); $modelo=$_GET["modelo"]; if ($modelo) { $md=$modelo; } else {$md=' ';} $sql2="SELECT precio FROM marcas WHERE marca='".$m."' and modelo='".$md."'"; $result2 = mysql_query($sql2, $conexio); ... <select name="marca" onChange="location.href='c0.php?marca=' + this.value"> <? if ($row = mysql_fetch_array($result)) { do {?> <option value='<? echo $row["marca"]; ?>' <? if ($marca == $row["marca"]) {echo "selected"; }?>><? echo $row["marca"]; ?></option> <? }while ($row = mysql_fetch_array($result)); }?> </select> ... <select name="modelo" onChange="location.href='c0.php?marca=' + '<? echo $marca; ?>' + '&modelo=' + this.value"> <? if ($row1 = mysql_fetch_array($result1)) { do {?> <option value='<? echo $row1["modelo"]; ?>' <? if ($modelo == $row1["modelo"]) {echo "selected"; }?>><? echo $row1["modelo"]; ?> </option> <? }while ($row1 = mysql_fetch_array($result1));}?> </select> _____________________________________________________________________________________________________________________ Allright!!! Now here comes the problem, the variable can´t get any string to reload the form for the selected option, it's become into a problem when in the "modelo" object only retrieve one option, and I need the value for another operation. And the question is, How can I fix that? ??? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/107831-trouble-with-a-jumpmenu-data-management/ Share on other sites More sharing options...
haku Posted May 29, 2008 Share Posted May 29, 2008 You cannot do this with pure php and/or html, you need javascript, or Ajax, which is an advanced form of javascript. Quote Link to comment https://forums.phpfreaks.com/topic/107831-trouble-with-a-jumpmenu-data-management/#findComment-553064 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.