2
Hello, I am using a Select to take data from the Marks table, and save the code and brand name when registering the product, but I am not able to save the data of both simultaneously, I can only save the code or brand name, if you change them in VALUE.
My SELECT is like this:
<label>Selecione a Marca:</label><br />
<select name="codmarca">
<?php
include '../conexao.php';
$select = mysql_query("SELECT * FROM marca");
while($res = mysql_fetch_array($select)){
?>
<option value="<?php echo $marca = $res['codigo'];?>"><?php echo $marca = $res['nome_marca'];?></option>
<?php } ?>
</select>
And that way I can only record the code, because it is he who is in VALUE at the moment.
How do I save code and tag at the same time using select, or not?
Thank you in advance for your attention to my problem.
I need to recover at least the name_tag on another page. Sorry E.Thomas, but I’m a layman in this part of explode, that part of the list I enter where? On the page where I will recover the data, or on the same page of SELECT?
– Murilo Cabral
Murilo, the explode is from PHP, according to your example. Imagine a string '3#PORSCHE'. When it is done: explodes('#', '3#PORSCHE') the return is an array with two elements. The list command puts the value of the first index (3) in the $code variable and the value of the second index (PORSCHE) in the $name variable. You must send this data and treat it in the . php file that inserts the information in the database, through a POST or GET.
– E.Thomas