0
I’m in doubt.
I have a questionnaire where the user will evaluate some sectors. I have for example:
<label>Higiene</label>
<select class="form-control" required >
<option value=""></option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<label>Organização</label>
<select class="form-control" required >
<option value=""></option>
<option value="1">1</option>
<option value="2">2</option>
</select>
<label>Ambiente</label>
<select class="form-control" required >
<option value=""></option>
<option value="1">1</option>
<option value="2">2</option>
</select>
I know I can take the value of select when using the name, but what I want to do is also take the word that is on the label and be able to reference and then save in the bank, so I can record in the bank the note that the user gave and to which sector he gave. For example:
SECTOR ---- NOTE -----
Hygiene 2
Organization 1
Environment 0
But by naming, for example, the first
<select>
asname='higiene'
you no longer know that this assessment is related to hygiene?– Woss
But when sending via POST, for example $_POST['hygiene'] I would only take the value of select, right? I need to somehow put Hygiene in some variable to be able to record in the bank, my form has several selects, I wanted to do it in a more dynamic way.
– Igor
$_POST
is an array, you can do the foreach...– Woss