CHANGE MY TABLE ID TO ANOTHER VALUE IN MY SELECT DEPENDENT #123355
-
BodyGreetings friends I have a small and big problem at the same time I need in a dynamic select to save another value instead of the id in my database for example I select a redip and in the BD I save the name not the id... I would very much appreciate the support provided. I'll leave you the code and the database so you can find your way around Guidelines
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Perhaps modifying the value attribute of the "redip" dropdown options from e.g
<div class="col-md">
<div class="form-floating">
<select name="redip" id="redip" class="form-select" aria-label="Default select example" required>
<option value="">Seleccionar</option>
<?php while($row = $estados->fetch_assoc()){ ?>
<option value="<?php echo $row['id_redip']; ?>"><?php echo $row['redip']; ?></option>
<?php } ?>
</select>
<label for="redip">Redip:</label>
</div>
</div>
<div class="col-md">
<div class="form-floating">
<select name="redip" id="redip" class="form-select" aria-label="Default select example" required>
<option value="">Seleccionar</option>
<?php while($row = $estados->fetch_assoc()){ ?>
<option value="<?php echo $row['redip']; ?>"><?php echo $row['redip']; ?></option>
<?php } ?>
</select>
<label for="redip">Redip:</label>
</div>
</div> |
Beta Was this translation helpful? Give feedback.
-
Greetings my friend, I didn't find your support because when I made the change when selecting an element of the REDIP table in my DB it does not display the states assigned to that REDIP since the REDI ID calls the state ID. If you require more arguments, I would be happy to send you more information about the project and thank you always for the support |
Beta Was this translation helpful? Give feedback.
-
const cbxRedip = document.getElementById('redip') const cbxEstado = document.getElementById('estado') const cbxMunicipio = document.getElementById('municipio') const cbxParroquia = document.getElementById('parroquia') const cbxCuadrante = document.getElementById('cuadrante') const cbxOrganismo = document.getElementById('organismo') function fetchAndSetData(url, formData, targetElement) { function getEstados() { fetchAndSetData(url, formData, cbxEstado) function getMunicipios() { fetchAndSetData(url, formData, cbxMunicipio) function getParroquias() { fetchAndSetData(url, formData, cbxParroquia) function getCuadrantes() { fetchAndSetData(url, formData, cbxCuadrante) function getOrganismos() { fetchAndSetData(url, formData, cbxOrganismo) |
Beta Was this translation helpful? Give feedback.
-
These are the requests made to the dynamic selections |
Beta Was this translation helpful? Give feedback.
-
Any support from the community that can guide me |
Beta Was this translation helpful? Give feedback.
-
Perhaps you could share the repo so people can easily locally reproduce the issue you're facing. |
Beta Was this translation helpful? Give feedback.
Greetings my friend, I didn't find your support because when I made the change when selecting an element of the REDIP table in my DB it does not display the states assigned to that REDIP since the REDI ID calls the state ID. If you require more arguments, I would be happy to send you more information about the project and thank you always for the support