ajax - how to add custom field option in php form for dynamic value storage -


how make php form in user allowed add custom field while filling form , data updates in database dynamically..

i searched lot on it, unfortunately unable use. thoight can achieved using zend or yii unable sort out.

use in view:

<script language="javascript"> function addinput() { document.getelementbyid('text').innerhtml += "field: <input name='alldata[]' type='text' value='' /><br />";  } </script> </head> <body> <form name="form"> <input type="button" onclick="addinput()" name="add" value="add input field" /> </form> <div id="text"> </div> 

and can fields in controller this:

<?php foreach($_post['alldata'] $row){ echo $row; echo '<br />'; }?>  

as passing array of input type=text name 'alldata'.


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -