Jump to content

How To Get Results From "i" Amount Of Forms?


Mariius

Recommended Posts

<html>
<body>
<?php


if (isset($_POST["kat_1"])) {
   echo($_POST['kat_1']);
 } else {
   forms();
 }


function forms() {
 echo '<form name="form1" method="post" action="">';
 for ($i=1; $i<=10; $i++) {
echo '
 <input type="text" name="kat_".$i." id="category">  
 <input type="text" name="kai_".$i." id="cost"><br />
   ';
 }
 echo '
<input type="hidden" name="index" id="index" value="$i">
<input type="submit" name="send" id="send" value="send">
</form>
 ';
}


?>
</body>
</html>

 

I want to make a page in which there would be "i" amount of forms and then I want to get results of these forms in the first if statement. I am trying to do so, but I don't get any results what so ever.

I would be glad to get some tips on this.

Thanks. :)

I would appreciate if you could help me once again:

this time I am trying to insert values to my sql.

$k=1;
while($k<=$category[0]) {
$baze="INSERT INTO Mine (date, category, cost)
VALUES
(CURDATE(),$category[$k],$cost[$k])";
$k++;
}

 

 

Here $category[0] is the amount of froms that have been printed out.

I get this error: Query was empty

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.