Capturing the input of dynamic form fields (part II)

From: Date: Sun, 15 Jun 2003 13:39:36 +0000
Subject: Capturing the input of dynamic form fields (part II)
Groups: php.general 
Request: Send a blank email to php-general+get-151574@lists.php.net to get a copy of this message
Dear all, Refering to my first e-mail with the same subject; I've reworked the code to this: But the only problem is; Nothing is written into the mysql database! And there are no error displayed.. Can someone have a look at my code? <? $_REQUEST["submit"]=isset($_REQUEST["submit"])?$_REQUEST["submit"]:""; if($_REQUEST['submit']!="") { for($i=0;$i<count($_POST['test1[]']);$i++) { $query="INSERT INTO test (test1, test2) VALUES ('$_POST['test1']','$_POST['test2']')"; $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error()); } } ?> <form name="form1" method=post id=form1 enctype=multipart/form-data action="<? $_SERVER['PHP_SELF']?>"> <? for ($i=1; $i<=2; $i++) { echo "# $i<input type=\"text\" name=\"test1[]\"><br>"; echo "# $i<input type=\"text\" name=\"test2[]\"><br>"; } ?> <input type=submit name=submit value=submit> </form> Thanks very much, Frank

« previous php.general (#151574) next »