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. :)

Link to comment
Share on other sites

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

Edited by Mariius
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.