is it possible to use two dimensional array in HTML like following code? I have tried but not work in PHP. <input type="text" name="import[fields][0]" > <input type="text" name="import[fields][1]" > <input type="text" name="import[fields][2]" >
It does work... Here's example code: <?php if ( isset($_POST['submit']) ) { print_r($_POST['field']); } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> <input type="text" name="field[one][1]" /> <input type="text" name="field[one][2]" /> <input type="text" name="field[one][3]" /> <br /><br /> <input type="text" name="field[two][1]" /> <input type="text" name="field[two][2]" /> <input type="text" name="field[two][3]" /> <br /><br /> <input type="submit" name="submit" /> </form> PHP: Here's the output:
<?php $import = array('fields' => array('a','b','c','d')); ?> <input type="text" name="<?php echo $import['fields'][0];?>" > <input type="text" name="<?php echo $import['fields'][1];?>" > <input type="text" name="<?php echo $import['fields'][2];?>" >
Hi Thanks for the reply. I just checked and found it working If I tried it normally. But It does not work in smarty? I just simply add this form in smarty and found following result. <form method="post" > <input type="text" name="field[two][1]" value="11"/> <input type="text" name="field[two][2]" value="22"/> <input type="text" name="field[two][3]" value="33"/> <input type="hidden" name="mode" value="upload_action"/> <input type="submit" name="submit" id="submit_id" value="Import" /> </form> Result: Array ( [two] => Array )