Cordial Greeting.
I hope you can help me with the problem I have, or an idea of how to achieve what I want.
I tell you what I want to do:
Each Field1 to Field5, Contains an SI Value or a NO value.
2. The select will be loaded: Example:
<select>
<option>Seleccionar</option>
<option>Prueba</option>
</select>
The test field is the one in the database, and contains the Id, Name, Field1, Field2, Field3, Field4, Field5.
What I want to do is if by selecting "Test" in the SELECT, I activate the input 1, if it has a value of "YES", If you do not have yes, the input should be disabled.
It is the same dynamic with the other inputs.
I do not know how to do it, I hope you can help me and I hope you understood me.
Thus I charge the Select:
<?php
include'conexion.php';
$sql = "EXEC SP_COMBO_PAGADURIAS";
$stmt = sqlsrv_prepare($conn, $sql);
if(sqlsrv_execute($stmt)){
$menu="<select name='menu' onchange='getComboC(this)' class='form-control' id ='menu'>\n<option selected>Seleccionar:</option>";
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC)){
$menu.="\n<option value='".$row['Campo1']."'>".utf8_encode($row['Nombre'])."</option>";
}
$menu.="\n</select>";
echo $menu;
}
?>
Inputs:
<?php
for ($i=0; $i<=5; $i++){
switch ($i){
case 0:
$pos = strpos($row, 'SI');
if($pos !== false ){
echo '<input type="text" class="form-control" name="uno" id="uno">';
}else{
echo '<input type="text" class="form-control" disabled name="uno" id="uno">';
}
break;
case 1:
$pos = strpos($Acceso, 'F');
if($pos !== false ){
echo '<input type="text" class="form-control" name="uno" id="uno">';
}else{
echo '<input type="text" disabled class="form-control" name="uno" id="uno">';
}
break;
case 2:
$pos = strpos($Acceso, 'R');
if($pos !== false ){
echo '<input type="text" class="form-control" name="uno" id="uno">';
}else{
echo '<input type="text" disabled class="form-control" name="uno" id="uno">';
}
break;
case 3:
$pos = strpos($Acceso, 'N');
if($pos !== false ){
echo '<input type="text" class="form-control" name="uno" id="uno">';
}else{
echo '<input type="text" disabled class="form-control" name="uno" id="uno">';
}
break;
case 4:
$pos = strpos($Acceso, 'N');
if($pos !== false ){
echo '<input type="text" class="form-control" name="uno" id="uno">';
}else{
echo '<input type="text" disabled class="form-control" name="uno" id="uno">';
}
break;
case 5:
$pos = strpos($Acceso, 'N');
if($pos !== false ){
echo '<input type="text" class="form-control" name="uno" id="uno">';
}else{
echo '<input type="text" disabled class="form-control" name="uno" id="uno">';
}
}
}
?>