1
Good afternoon, you guys.
I have a question about recording several inputs with the same id in Mysql, I have already searched several pages and I haven’t been able to find a solution for how to do it. I have a client registration, which is currently in a single table, and I am making it be recorded each part of the registration in a table. And in the section I’m in, it works like this I have the code
<div class="tab-content">
<div class="tab-pane active" id="tab_1">
<div class="box box-solid box-info">
<div class="box-header">
<h3 class="box-title">CAIXA 1</h3>
</div>
<div class="col-xs-4"><label>Versão</label>
<input type="text" class="form-control" name="versao[]" id="vpos" data-inputmask="'mask': ['99.99.99', '999999']" data-mask>
</div>
<div class="col-xs-4"><label>Layout</label>
<input type="text" class="form-control" name="vpos[]" id="vpos" data-inputmask="'mask': ['99.99', '9999']" data-mask>
</div>
<div class="col-xs-4"><label>Numero Série:</label>
<input type="text" class="form-control" name="nserie[]" id="nserie" placeholder="Numero de Série" data-inputmask="'mask': ['999999999-99', '99999999999']" data-mask >
</div>
<div class="col-xs-4"><label>Código Ativação</label>
<input type="text" class="form-control" name="codativ[]" id="codativ" >
</div>
<div class="col-xs-4"><label>Código Segurança</label>
<input type="text" class="form-control" name="codseg[]" id="codseg">
</div>
and I have 5 tabs and all inputs have same name, but tabs have their ids. And in this case, what would be the correct way for me to use, to then return the data in the same tabs. A clearing for me to follow the path.
I understood more or less the scheme of the array using the same names, but I found it confusing. Is it not simpler to use instead of arrays of Names to use names like tab1_versao, tab2_versao, tab3_versao... , tab1_vpos, tab2_vpos, tab3_vpos... etc?
– Antonio Alexandre
from what I understand you say I create new columns in the table?
– Augusto
No need to create new columns, but if you have to differentiate the inputs by tab you will have to rename them. Another solution is to use
versao[tab1]
,vpos[tab1]
. When this input arrives in the back end there you separate the values correctly and write in the original columns.– Ricardo Moraleida
Certinho, just a question, that returned me the error, in saving the form in the database, I have 10 related tables, I used Inner Join in this form foreach($_POST["version"] as $versao); foreach($_POST["vpos"] as $vpos); $sql = mysql_query("UPDATE * FROM client Inner Join data_client on client.idc = data_client.id; , thus following other Inner, but with error
– Augusto