hi there!
i have problems handling forms.
My purpose is "pull" data from DB and show them in a HTML List/Menu.
All Ok.
All process is Ok, but my customer needs to say Vehicle_Name(for example), and i need to store Vehicle_Id. (Isn't convenient show him Vehicle_Id ....the customer doesn't know which Vehicle_Name is which Vehicle_Id.
The problem is when i store the Vehicle_Id, the php script doesn't store it correctly.
Even store the Vehicle_Id of First running.
Sorry, i don't write english very well.
If anyone understand spanish, let's me know please..i'll give a lot of thanks.
**Jose
my address mail :sistemas@interaxiss.com
Thanks a Lot
Best Regards
The code fragment is:
<form method="get" action="altas_vehiculos1.phtml">
<p><font face="Tahoma"><b>Alta de Vehiculos</b></font></p>
<p> </p>
<table width="68" border="1">
<tr>
<td><font face="Tahoma" size="3">Plaza<br>
</font></td>
<td>
<select name="nom_plaza">
<?php
mysql_connect (localhost, root); mysql_select_db (lloguer);
$result = mysql_query("SELECT DISTINCT nom_plaza from plaza ORDER BY num_plaza");
printf("<select>");
print ("<option selected>Seleccione una categorÃa</option>");
while ($myrow = mysql_fetch_array($result))
{
printf("<option value='$myrow[nom_plaza]'>$myrow[nom_plaza]</option>");
}
print ("</select>");
?> >
</select>
</td>
</tr>
<tr>
<td><font face="Tahoma">Nombre del Vehiculo </font></td>
<td>
<input type="text" name="nom_vehiculo" size="40" maxlength="40">
...
the code fragment that process this form:
<?php
mysql_connect (localhost, root ); mysql_select_db (lloguer);
$plaza_aux= mysql_query("SELECT num_plaza FROM plaza WHERE nom_plaza= '$nom_plaza'");
mysql_query ("
INSERT INTO vehiculo ( num_plaza, nom_vehiculo, marca_vehiculo, mod_vehiculo, color_vehiculo, transm_vehiculo, ac_vehiculo, descripgral_vehiculo, cant_vehiculo)
VALUES ('$plaza_aux', '$nom_vehiculo', '$marca_vehiculo','$mod_vehiculo','$color_vehiculo', '$transm_vehiculo', '$ac_vehiculo', '$descripgral_vehiculo', '$cant_vehiculo')
");
?>