Jump to content
br

Chamar varias vezes uma funçao

Recommended Posts

br

boa tarde

tenho um form

mas quero adicionar varias vezes estes elementos e chamar sempre a mesma funçao no submit

mas assim nao da, pois os ids teem que ser unicos.

como posso fazer isto funcionar so um form?

<form name="frmTranslations" action="javascript:insert()" method="post">
           <table border ='1'>
               <tr><td>Text</td><td>Translation</td></tr>
               <?php
               while ($translations = mysql_fetch_array($result)){
                   echo "<tr><td>";
                   echo "<input name='idEng' type='hidden' id='idEng' value='".$translations["EnglishID"]."'/>";
                   echo $translations["strText"]."</td><td>";
                   echo "<input name='txtTrans' type='text' id='txtTrans' value=''/>";
                   echo "<input name='submit' type='submit' value='Insert'/></td></tr>";
               }
               ?>
           </table>
       </form>

cumprimentos

Edited by brunoais
geshi

Share this post


Link to post
Share on other sites
Diogo Henrique

Chamas com o post o submit.

Fica assim:


$variável=$_POST['submit'];

Espero ter ajudado :)

Share this post


Link to post
Share on other sites
br

eu quero um form para completar uma tabela

a função passa-me so os valores e chama uma pagina php para guardar na bd

existe alguma forma de passar os ids do input para um array?

Share this post


Link to post
Share on other sites
br

Eu consigo fazer um a um

<form name="frmTranslations<?php echo $i; ?>" action="<?php echo $_SERVER['PHP_SELF']."?add=true"; ?>" method="post">
               <input name="idEng" type="hidden" id="<?php echo "idEng[".$i."]"; ?>" value="<?php echo $translations["EnglishID"]; ?>"/>
               <?php echo $translations["strText"]; ?>
               <input name="txtTrans" type="text" id="<?php echo "txtTrans[".$i."]"; ?>" />
               <input name="submit" type="submit" value="Insert" />
       </form>

mas como posso fazer so com um form e so um submit?

Edited by brunoais
geshi

Share this post


Link to post
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

×
×
  • 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.