1
Is it possible to take the name of a variable and use it as a string ?
Situation:
I have a form full of inputs when sending them step by step with their name and value, but I also need to update them in the BD using their correct id to insert, in the input value is used to pass urls. then I was thinking of giving the id on the receiving name then Array( "id_1"=>"http://exemplo.com")
. But I need the ID to insert in the correct line of the comic.
<?php
for ($i = 0; $i < $nomeDasTabelas['value']; $i ++) {
$aux = $i + 1;
echo '<div class="object">
<form method="GET" action="index.php">
<div class="grade">
<input type="hidden" name="serie" value="'.$aboutSerie[0].'">';
for ($is = 0; $is < $valorDeLinks[$i]; $is ++) {
$auxs = $is + 1;
$tabelaDeIds = $idDosLinks[$i];
$idDoLink = $tabelaDeIds[$is];
$btndel = '&btn=btndel&tab=' . $nomeDasTabelas[$i] . '&id=' . $idDoLink;
echo ($is % 4 == 0) ? '<br>' : "";
echo '<label for="txtboxtp' . $aux . 'ep' . $auxs . '">Ep' . $auxs . '|</label>
<input id="txtboxtp' . $aux . 'ep' . $auxs . '" type="text" class="textbox" name="' . $is . '" value="http://">
<a href="index.php?serie=' . $aboutSerie[0] . $btndel . '"><button class="btndel" type="button" name="btndel" title="Excluir"><img src="../imgsys/icon_del.png" alt="Del" title="Excluir"></button></a>
<input type="hidden" name="ep'.$is.'" value="'.$idDoLink.'">';
}
Explain your problem better, show a code of what’s doing it. If I understood, I’d practically have to do nothing but for safety.
– Maniero
Good thinking here and I decided to create inputs of type Hidden and pass in its values the input id that contains the URL.
– ayelsew
This doesn’t show what you want to do in the database, but more and more I think you’re wanting to do something unsafe.
– Maniero
I posted the code. So I loaded the BD Urls for input so they can be edited. Well in the BD they each have an id. Dai want to update the values in their corresponding id.
– ayelsew
Do you have an exact amount of records returned from the BD or do you take everyone you have and create as many inputs as necessary? A solution using jQuery (also) would serve?
– Jhonatan Pereira
create the required amount of inputs.
– ayelsew