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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.