Jump to content

Trouble with a JumpMenu data management


L34L

Recommended Posts

Here we go:

Two dynamic JumpMenu must be created through a MySQL query and this works for me:  8)

_____________________________________________________________________________________________________________________

 

$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  ;D

 

 

Link to comment
https://forums.phpfreaks.com/topic/107831-trouble-with-a-jumpmenu-data-management/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.