Drop down does not show data

0

I have the solution.

I only had to change some connections

if (isset($_REQUEST['action'])) {
switch ($_REQUEST['action']) {
    case 'actualizar':



        // Recupero el id del campo hidden

        $alm->__SET('acro_documento', $_REQUEST['acro_documento']);
        $alm->__SET('acro_subcategoria', $_REQUEST['acro_sub']);
        $alm->__SET('tipo_documento', $_REQUEST['tipo_documento']);
        $alm->__SET('registro_calidad', $_REQUEST['registro_calidad']);
        $alm->__SET('calidad_code', $_REQUEST['calidad_code']);
        $alm->__SET('cod_tempo', $_REQUEST['cod_tempo']);

        $update_results = $model->Actualizar($alm, $_POST['id']);


        header('Location: index2.php');

        break;

Where I have acronimo_subcategoria I said that I would recover for $ _REQUEST the same field, and the select was called otherwise, only to change it here the value takes it perfectly.

I can only get that by pressing the edit button the select picks up the value of that field, that is more visual than anything else, but it would be better. I hope someone can help you.

-------- Initial Post ----

Okay. I have two table Table subcategories that contains: subcategory and description. Type table that contains: type, subcategory and description. I need a drop down list that contains all the existing subcategories of the first table in the table typedocumentos. I get this but I am not able to add it in the second table because it is thought that the modification or insertion I want to do in the first and pulls repeated primary key error for example

<select id="teamlist" name="teamlist">
<?php
$pdo = new PDO('mysql:host=localhost;dbname=deimos1', 'root', '');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $pdo->prepare('Select acro_sub from subcategoria');
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
echo '<option>' . $row['acro_sub'] . '</option>'; }?>
</select>

But now I must combine it with this one that collects the data to edit

<td><input type="" name="acro_subcategoria"  value="<?php echo isset($obj_categoria) ? $obj_categoria->__GET('acro_subcategoria') : ''; ?>" style="width:100%;" required /></td>

Because it looks like this

link

And when you click edit, I want you to pick up the data that you get and if I modify it in the select it will be modified in the one next to it, I know it's a bit complicated but thanks for your help.

    
asked by Alberto Cepero de Andrés 18.04.2017 в 12:14
source

0 answers