DOM input does not show at $_POST

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
tamanduarj
Forum Newbie
Posts: 2
Joined: Tue Mar 20, 2007 7:33 am

DOM input does not show at $_POST

Post by tamanduarj »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi there... Saw that another topic seed some thing about it but could not figure out how was it solved. So here goes my question:

Code: Select all

<?php
echo "
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>
<head>
<title>Documento sem t&iacute;tulo</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
<META HTTP-EQUIV='Pragma' CONTENT='no-cache'>
<META HTTP-EQUIV='Expires' CONTENT='-1'>
</head>
<body>
  <form name='teste_form' method='post' id='teste_form' action='sefodeai.php'>
  <input type='button' id='bt_adciona' value='Adcionar' onclick='addRowClone(\"tabela\")';
  <br> 
  <table border='1' align='center' cols='1' name='tabela' id='tabela'> 
  <tbody id='corpo'> 
        <tr>
            <td>
                <input type='text' name='entrada' id='entrada'>
            </td>
        </tr> 
    </tbody>
  </table>
  <input type='submit' name='bt_submit'> 
  </form>   
    
<SCRIPT language=javascript>
function addRowClone(tblId) {


  var tblBody = document.getElementById(tblId).tBodies[0];
  var newNode = tblBody.rows[0].cloneNode(true);
  var qtd_atos = 10;
    
  for(a=1; a<=qtd_atos; a++){
     newNode = tblBody.rows[0].cloneNode(true);
     tblBody.appendChild(newNode);
  }  
  
}  
</SCRIPT>
</body>
</html>";     
?>
First you click on the adcionar buttom so it makes 10 clones of the input field 'entrada'
If you press submit sefodeai.php would recive 11 inpui fields but only the first one shows.

Any help ??

Thanks


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

Well, I don't know much about cloning, but does cloning give them all the same name? If so, accessing the $_POST array associatively would only give you one of them.
Post Reply