Jump to content

Botão com parâmetro


glicose
 Share

Recommended Posts

Olá, eu estou precisando de um botão que passe um parametro no submit

while($linha=mysql_fetch_array($busca)){
                $item_id=$linha[item_id];
?>
   <tr>
            <td><?=$linha[prod_nome]?></td>
            <td><?=$linha[prod_preco]?></td>
             <td><input type="image" src="../images/bt_alterar.gif"</td>
   <tr>
<? }  ?>

A idéia era passar um índice pro botão, pra poder atualizar apenas o valor de 1 produto

Como poderia fazer isso?

Grato

APARTE: Usa o Geshi, torna o post mais apresentável. 🙂

Link to comment
Share on other sites

Consegui resolver com aquele javascript que vc respondeu no outro post

só implementei essa linha:

<td><input type="image" src="../images/bt_alterar.gif" onclick="addind('indice','<?=$item_id?>')"></td>

usando esse javascript:

function addind(divName, indice){
    var newdiv = document.createElement('div');
    newdiv.innerHTML = '<input type="hidden" name="indice" value="'+indice+'">';
    document.getElementById(divName).appendChild(newdiv);
}

Será que tem algum jeito melhor?

Aonde eu acho esse Geshi, eu procurei aqui mas não achei...É um botão?

Grato

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.