How to make a dynamic url in Codeigniter?

0

I'm making a sale that inserts and updates me in my database, but when I want to delete one of those records I do not know how to do it so I can identify the function to go to the DELETE of my driver Control I have this from the side of the view:

   <?php
if (isset($persona_actualizar)) {
    $id = '<p><input type="hidden" name="id" value="' . $this->uri->segment(3) . '"></p>';

    $nombre = $persona_actualizar->nombre;
    $edad = $persona_actualizar->edad;
    $email = $persona_actualizar->email;
    $pais = $persona_actualizar->pais;
    $accion = 'actualizar';
}
else {
    $id = '';
    $nombre = '';
    $edad = '';
    $email = '';
    $pais = '';
    $accion = 'insertar';
}
?>

 <form action="<?php echo base_url(); ?>control/<?php echo $accion; ?>" method="POST"> 
                <?php echo $id; ?>

                <p>
                    <label>Nombre:</label>
                    <input type="text" name="nombre" value="<?php echo $nombre; ?>"/>

                </p>
                <p>
                    <label>Edad:</label>
                    <input type="text" name="edad" value="<?php echo $edad; ?>"/>
                </p>
                <p>
                    <label>Email:</label>
                    <input type="text" name="email" value="<?php echo $email; ?>"/>
                </p>
                <p>
                    <label>Pais:</label>
                    <input type="text" name="pais" value="<?php echo $pais; ?>"/>
                </p>
                <p>
                    <input type="submit" name="guardar" value="Registrar"/>
                </p>
            </form>

I do not know how to do so in that IF I identify that you should go to the DELETE

Thank you very much in advance.

    
asked by Oscar Chavez 31.08.2018 в 00:09
source

0 answers