12-22-2016, 10:20 PM
If multiple people are using the site at the same time, that will not be accurate. Can you pastebin your task and task_sub queries?
The following warnings occurred: | ||||||||||||
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
|
Insert multiple from input checkbox
|
12-22-2016, 10:20 PM
If multiple people are using the site at the same time, that will not be accurate. Can you pastebin your task and task_sub queries?
12-23-2016, 09:47 AM
you have all my task and sub task query up there (December 21, 2016 at 7:06 pm)
12-23-2016, 01:47 PM
Sorry....when you post big chunks of code on this site I lose the formatting so I have a hard time figuring out what code I am looking at. Can you post just the part you're having problems with on pastebin?
12-23-2016, 10:52 PM
ok,
INSERT query <pre> Code: // prepare sql and bind parameters and here is the form <pre> Code: <form id="demo-form2" class="form-horizontal form-label-left " action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST" id="payment-form">
12-23-2016, 11:10 PM
Ahh. I see what's going on. You're not able to use our lastid function because you're not using our db class. It's really not that hard. I see several things...
the header redirect could cause problems and give you "headers already sent" errors. That's why we have the Code: Redirect::to('account.php'); Second, by getting the info from Code: $_POST Code: Input::get This is your insert query reformatted with the id returned to you as Code: $newTaskId http://pastebin.com/W9Uag7Gj Note...that if you don't need all those variables, it could be as simple as this... http://pastebin.com/ZShrgaeJ That last version cuts out 15 lines of code and does the same thing. Let me know if something doesn't make sense.
12-23-2016, 11:12 PM
By the way, I love your css styling. I think if we combined my PHP with your CSS/HTML, we could do something cool!
12-24-2016, 11:46 AM
I like your script query, everything seems to be fine now, but still can not get the ID from Task tabele and insert in to task_list_sub tabele in task_id.
and i have other problem, I want to add more users to help exmp: Task tabel Id 35 username Picassoo detalis userspice id 1 username Alexandra detalis userspice1 id2 username Marya detalis userspice2 etc..., And alll the users will be insert to task_list_sub tabele. What i need here is insert from <input type='checkbox' name='utilizator[]' autocomplete='off' value=''> and to take the lastID from task ID, and insert to task_list_sub tabele in task_id. here is all your query and my form http://pastebin.com/1Bfz20x8
12-24-2016, 11:48 AM
hahah, I love to help you, but I need your clean userspice 5.. v to start to update my css to your form.
I update your 4.2 v to my css style if you need
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 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.
12-24-2016, 08:25 PM
nice, I fix someting from your code to my query, but stil I have some problem in second query. I want insert multiple checkbox values in task_list_sub tabele.
|