ASP how to send ID to a form

0

What I want to realize is that each time you select the edit button as shown in the image

Redirects me to a form where the input captures the selected data

For example, if I select Edit Truck, it appears in the truck editing input.

Table code

<%
dim i, Q
dim listaTipo

Q = "SELECT t.cTipo, "&_
"       t.Tipo_Auto "&_
"FROM dbo.Arriendo_TipoAuto t "&_
"ORDER BY t.Tipo_Auto;"

 Q = "SELECT t.cTipo "
 Q=Q&"    , t.Tipo_Auto "   
 Q=Q&"FROM dbo.Arriendo_TipoAuto t "
 Q=Q&"ORDER BY t.Tipo_Auto;"

 listaTipo = getDBT(Q)

%>

<%

 if isArray(listaTipo) then
 Response.Write("<div class='row-fluid sortable'>")
 Response.write("<div class='box span6'>")
 Response.Write("<div class='header'>")
 response.write("<h2><i class=''></i><span class='break'></span>TABLA TIPOS DE AUTOS</h2>")
 Response.Write("<table class='table table-bordered table-striped table-condensed'><thead><tr><th>ID Auto</th><th>Tipo de Auto</th><th>Accion</th></tr></thead>")
 for i = lbound(listaTipo ,2) to ubound(listaTipo ,2)             
      Response.write (" <tr><td>"& listaTipo(0,i) &"</td><td>"& listaTipo(1,i) &"</td><td><a class='' href='editar_tipo.asp'><i class='fa-icon-edit'></i></a></td></tr>")

 next
 Response.Write("</table>")
 Response.write("</div>")
 Response.write("</div>")
 response.write("</div>")

 else
 response.write ("<div class='alert' >")
 response.write ("No existen registros de tipos de autos")
 response.write ("</div>")
 end if

 %>

Form code

<div class="row-fluid">
<div class="box-content">
    <form class="form-horizontal" method="post" action="editar_tipo2.asp" >
        <fieldset>
            <div class="control-group">
                <label class="control-label" for="focusedInput">EDITAR TIPO AUTO</label>
                <div class="controls">
                  <input class="input-xlarge focused" name ="nombre_auto" id="focusedInput" type="text" value="">
                </div>
            </div>
            <div class="row-fluid sortable">
                <div class="form-actions">
                    <button type="submit" class="btn btn-primary">Guardar Auto</button>
                    <button type="reset" class="btn">Cancelar</button>
                </div>
            </div>
        </fieldset>
    </form>
</div><!--/span-->

    
asked by Daniela 07.11.2018 в 15:15
source

1 answer

0

you could pass the value you want to edit by the querystring and then retrieve it in the form. I explain ... in the code where you generate the list, you should add this that I put:

for i = lbound(listaTipo ,2) to ubound(listaTipo ,2)             
  Response.write (" <tr><td>"& listaTipo(0,i) &"</td><td>"& listaTipo(1,i) &"</td><td><a class='' href='editar_tipo.asp?TIPO_AUTO=<%=listaTipo(1,i)%>'><i class='fa-icon-edit'></i></a></td></tr>")

next

Subsequently, in the code of the editing form, you should recover what comes by querystring in a variable and show the value of that variable in the input, in this way:

 dim valorRecogido

PickUp = Request.querystring ("TYPE_AUTO")

And show it in the input:

<input class="input-xlarge focused" name ="nombre_auto" id="focusedInput" type="text" value="<%=valorRecogido%>">

I hope it serves you.

Greetings.

    
answered by 07.12.2018 в 10:34