Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery dynamic form and dynamic population
    primarykey
    data
    text
    <p>I am trying to put to work this simple script that stores phone numbers in a .txt file. The problem is I can't populate correctly with the jquery-dynamic-form. Any idea on how to fix this? Thanks a lot in advance.</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt;&lt;head&gt; &lt;script type="text/javascript" src="lib/jquery/jquery-1.4.2.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="lib/jquery/jquery-ui-1.8.2.custom.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery-dynamic-form.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $("#phone2Template").dynamicForm("#plus6", "#minus6", {limit:5, createColor:"red"}); }); &lt;/script&gt; &lt;/head&gt;&lt;body&gt;&lt;pre&gt; &lt;?php if(!empty($_POST)){ // var_dump($_POST); $f = @fopen ("phones.txt","w"); foreach ($_POST['phone2Template']['phone2Template'] as $key) { $lines .= $key['phone2']."\n"; } fwrite($f, "$lines");fclose($f);} else { $f = @fopen ("phones.txt","r"); $result = fread($f,filesize("phones.txt")); fclose($f); $alllines = split("\n",$result); echo '&lt;/pre&gt;&lt;form method="post" action="#" value="Post"&gt; &lt;fieldset&gt;&lt;p id=\'phone2Template\'&gt;'; for($i=0;$i&lt;count($alllines);$i++) { echo '&lt;label for="phone2"&gt;telephone: &lt;/label&gt;&lt;input id="phone2" type="text" name="phone2" value='.$alllines[$i].'&gt;&lt;br /&gt;'; } echo '&lt;span style="clear:none; float:right;"&gt;&lt;a id="minus6" href=""&gt;[-]&lt;/a&gt; &lt;a id="plus6" href=""&gt;[+]&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;/fieldset&gt;&lt;input type="submit" /&gt;&lt;/form&gt;&lt;/body&gt;&lt;/html&gt;'; } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload