php form. help

Permalink
I there, i have a form that loads info from db and then it saves it to another table of the db.
but theres one problem.


<select style="width:250px;" name="cod_disciplina" onChange="autoSubmit();"> 
            <option value="cod_disciplina">Selecione a disciplina</option> 
            <?php 
    $sql3 = "SELECT * FROM disciplina WHERE cod_ano = $ano AND cod_curso = $curso "; 
    $array3 = mysql_query($sql3,$conn); 
    while($row = mysql_fetch_array($array3)) 
    { 
    echo ("<option value=\"$row[cod_disciplina]\" " . ($disciplina == $row["cod_disciplina"]? " selected" : "") . ">$row[nome_disciplina]</option>"); 
    } 
    ?>


as you can see this select get the primary key that is needed to load the data to next select and presents the name in the select. but i need to save the $row[nome_disciplina] and its saving $row["cod_disciplina"]

 
synlag replied on at Permalink Reply
synlag
Hi,

it seems like the values for your options are wrong, try:

<select style="width:250px;" name="cod_disciplina" onChange="autoSubmit();"> 
            <option value="cod_disciplina">Selecione a disciplina</option> 
            <?php 
    $sql3 = "SELECT * FROM disciplina WHERE cod_ano = $ano AND cod_curso = $curso "; 
    $array3 = mysql_query($sql3,$conn); 
    while($row = mysql_fetch_array($array3)) 
    { 
    echo ("<option value=\"$row[nome_disciplina]\" " . ($disciplina == $row["cod_disciplina"]? " selected" : "") . ">$row[nome_disciplina]</option>"); 
    } 
    ?>


Greets
ranonymus replied on at Permalink Reply
that doenst work....
i will show you full code.
<?php 
    $ano = $curso = $disciplina = $modulo = $eq = null; //declare vars 
    $conn = mysql_connect("localhost", "root", ""); 
    $db = mysql_select_db('concrete',$conn); 
    if(isset($_GET["cod_ano"]) && is_numeric($_GET["cod_ano"])) 
    { 
    $ano = $_GET["cod_ano"]; 
    } 
   if(isset($_GET["cod_curso"]) && is_numeric($_GET["cod_curso"])) 
    { 
    $curso = $_GET["cod_curso"]; 
    } 
   if(isset($_GET["cod_disciplina"]) && is_numeric($_GET["cod_disciplina"])) 
    { 
    $disciplina = $_GET["cod_disciplina"];




so u know my problem....
can some1 help?