12-24-2016, 04:05 PM
I'm not 100{3bc1fe685386cc4c3ab89a3f76566d8931e181ad17f08aed9ad73b30bf28114d} following, but I think I'm getting the gist of what is going on.
You can put something inside the [] on your form input if you need to.
So in other words, if you have
You can either put an $id or you can take that thing from my pastebin where I did the insert and then put
You can take that newTaskId and put it in your name field
Then, when you are in your form processing
//You'll see that you can
//and
//and you have that information separately.
So, here is an example of where I use this in an online ordering system.
http://pastebin.com/sUqszW8h
On line 6 I want to make sure that the quantity is not 0 or less (if it is, I ignore it)
Then I take each row and turn it into a key->value pair
Then I go row by row and multiply my price x quantity to get the total cost
Then I check to see if that order number was already in the system
If it was, I update the order
If it was not, I insert a new one.
You can put something inside the [] on your form input if you need to.
So in other words, if you have
Code:
<input type='checkbox' name='utilizator[]' autocomplete='off' value=''>
You can either put an $id or you can take that thing from my pastebin where I did the insert and then put
Code:
$db->insert('task_list_sub',$fields);
Code:
$newTaskId = $db->lastId();
You can take that newTaskId and put it in your name field
Code:
name='utilizator[<?=$newTaskId]'
Then, when you are in your form processing
Code:
if(!empty($_POST)){
Code:
foreach($_POST['utilizator'] as $key => $value) {
Code:
dump($key);
Code:
dump($value);
Code:
}
So, here is an example of where I use this in an online ordering system.
http://pastebin.com/sUqszW8h
On line 6 I want to make sure that the quantity is not 0 or less (if it is, I ignore it)
Then I take each row and turn it into a key->value pair
Then I go row by row and multiply my price x quantity to get the total cost
Then I check to see if that order number was already in the system
If it was, I update the order
If it was not, I insert a new one.