Jump to content
#StayAtHome ×


  • Content Count

  • Joined

  • Last visited

Community Reputation

1 Neutral

About Adamhumbug

  • Rank
    Advanced Member
  1. I have the following script in here if this is going to help function allowDrop(ev) { ev.preventDefault(); } function drag(ev) { ev .dataTransfer .setData("text", ev.target.id); } function drop(ev) { ev.preventDefault(); var data = ev.dataTransfer.getData("text"); ev.target.appendChild(document.getElementById(data)); }
  2. ok thanks for that if an admin would be so kind as to move this, it would be appreciated.
  3. Hi, not sure if this is more of a JS or PHP question but here goes. I have a form that populates people into a box. There name is on a div that looks like a button. Also inside the div are 2 hidden inputs. I plan on dragging some people from box 1 into box 2. When moving, i would like everyone in box 2 to have their second hidden input to be changed so when i submit it will be clear who was in which box. It currently looks like this when populated if that helps anyone. <div class="mt-3 col-6"> <div class="container border border-dark p-1 h-50" ondrop="drop(event)" ondragover="allowDrop(event)"> <div class="alert alert-warning text-center">Making Own Way</div> <div id="2" class="btn btn-primary m-1" data-id="2" data-role="Manager" draggable="true" ondragstart="drag(event)"> <input class="staff" name="staff[]" type="hidden" value="2"> <input class="transMethod" name="trans[]" type="hidden" value="mow"> Chelsea Hockley</div><div id="16" class="btn btn-primary m-1" data-id="16" data-role="Manager" draggable="true" ondragstart="drag(event)"> <input class="staff" name="staff[]" type="hidden" value="16"> <input class="transMethod" name="trans[]" type="hidden" value="mow"> TEST MANAGER</div> </div> </div> <div class="mt-3 col-6"> <div class="container container border border-dark p-1 h-50" ondrop="drop(event)" ondragover="allowDrop(event)"> <div class="alert alert-primary text-center">Need Transport Daily</div> </div> </div>
  4. When i click my submit button i am posting the following. Array ( [submitStaffOrder] => [staffMember] => Array ( [0] => 2 [1] => ANYCHEF1 ) [date] => Array ( [0] => 2020-02-18 [1] => 2020-02-18 ) [startTime] => Array ( [0] => 11:01 [1] => 10:10 ) [finishTime] => Array ( [0] => 11:01 [1] => 10:01 ) [delExisting] => Array ( [0] => [1] => toDel ) ) I would like to update/insert if delExisting is blank and delete if it has toDel in there. I have the following but i am pretty sure the if is not working. $date = $_POST['date']; $stime = $_POST['startTime']; $ftime = $_POST['finishTime']; $del = $_POST['delExisting']; $staff = $_POST['staffMember']; $stmt = $conn -> prepare(" INSERT IGNORE INTO ssm_staff_order (job_id, staff_id, staff_start_time, staff_finish_time, staff_start_date, staff_finish_date) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE staff_start_time = VALUES(staff_start_time), staff_finish_time = VALUES(staff_finish_time); "); $delstmt = $conn -> prepare(" DELETE FROM ssm_staff_order WHERE staff_id = ? AND job_id = ? AND staff_start_date = ? "); foreach ($staff as $key => $staffId) { if ($del == '') { $start = $date[$key].' '.$stime[$key]; $finish = $date[$key].' '.$ftime[$key]; $stmt -> bind_param('isssss', $jid, $staffId, $start, $finish, $date[$key], $date[$key]); $stmt -> execute(); } if ($del == 'toDel') { $delstmt -> bind_param('sis', $staffId, $jid, $date[$key]); $delstmt -> execute(); } } } Can i do what i am trying to do or am i way off here? I struggle with arrays
  5. When i do the following: while ($stmt -> fetch()) { $user =[$role, $fn, $ln, $id]; } i only get one result and i know the sql is pulling 3 results. I tried using .= but that give me an array to string error.
  6. Hi All, I have a select statement $stmt = $conn -> prepare(' SELECT u.user_firstname, u.user_lastname, so.staff_id, r.role_name FROM ssm_staff_order so INNER JOIN ssm_user u on so.staff_id = u.user_id INNER JOIN ssm_role r on u.user_role_id = r.role_id WHERE job_id = ? '); $stmt -> bind_param('i', $jid); $stmt -> execute(); $stmt -> bind_result($fn, $ln, $id, $role); The result looks like this +----------------+---------------+----------+-----------+ | user_firstname | user_lastname | staff_id | role_name | +----------------+---------------+----------+-----------+ | FName | LName | 8 | Chef | | jon | smith | 15 | Manager | | Chelsea | Hockley | 2 | Manager | +----------------+---------------+----------+-----------+ I am wanting to build an array so that i can foreach the result with the people under the header of their role. I know this is not difficult but i am going around and around with it and clearly missing the key part. As always your help is appreciated.
  7. A bit of working out here but that worked perfectly. Thank You
  8. I have an array that has comma sep values. I am wanting to run a select statement that includes a NOT IN function. SELECT user_firstname, user_lastname, user_id FROM ssm_user WHERE user_role_id = ? and where user_id NOT IN(?) Is this possible, oir does the ? just represent a literal string. If so do i need to convert the array to a string before running the above?
  9. I think i have answered my own question about 10 seconds after posting this. if(!empty($_SESSION['message'])){ doesnt seem to generate the same message that if($_SESSION['message'] !=''){ did Thanks anyway
  10. I have a message bar that when a page reloads, a message appears at the top of the screen. I feed the message with session variables that are set at the end of the action (submission for example) When the page reloads the message displays and then unsets the session variables. The issue is when the page first loads (when it has never run an action) and gives me the Notice: Undefined index: message. My question is, how can i handle the session being blank when the page first loads and thus not get the notice.
  11. <a onclick='delModal($miid);' data-toggle='modal' href='#delConfModal' data-id='$miid' class='delButton btn btn-danger'>Delete Menu Item</a> seems to be working
  12. i think i have corrected this by passing the menu item id in the function call
  • 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.