Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Štvrtok, 28. marec 2024
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  Mutiple selection using checboxes for deletion

phpMyEdit Features     Mutiple selection using checboxes for deletion
Odoslať novú tému   Odpovedať na tému    
 
okello     Založený: 13.05.2007   Príspevky: 1  
Príspevok Zaslal: 2007-05-13 08:03
Návrat hore  Odpovedať s citátom     

I'm just wondering whether I can use checkboxes instead of radio buttons to select multiple records to delete at the same time in phpMyEdit.

Someone help, plz.

 
danvolkov     Založený: 02.10.2007   Príspevky: 7  
Príspevok Zaslal: 2007-10-03 16:51
Návrat hore  Odpovedať s citátom     

It is possible. In fact, I'm using multiple check boxes on my PME. Please let me know if still relevant for you, and I'll send you the code.

Dan

 
wizwareinc     Založený: 14.10.2007   Príspevky: 1  
Príspevok Zaslal: 2007-10-14 00:43
Návrat hore  Odpovedať s citátom     

I need this feature badly. Could you please please please post the code???

MUCH appreciated,
Mark

 
danvolkov     Založený: 02.10.2007   Príspevky: 7  
Príspevok Zaslal: 2007-10-14 11:15
Návrat hore  Odpovedať s citátom     

Okay, here is what you do:

1) disable automatic construction of a form element:

Kód:

$opts['display'] = array(
   'form'  => false, // set this one to false
   'query' => true,
   'sort'  => true,
   'time'  => false,
   'tabs'  => true
);


2) add multiple check boxes to PME columns (add this in the beginning of your '$opts' section)

Kód:
$opts['fdd']['check'] = array(
  'sql|LF'    => "concat('<input type=\"checkbox\" name=\"checked',PMEtable0.".$opts['key'].",'\">')",
  'name'     => 'Check',
  'colattrs' => 'align="center"',
  'escape'   => false,
  'options'  => 'LF' 
);


3) add the following after '$opts' section but before a call to phpMyEdit:

Kód:

// Adding a form element and 'delete_request' field

echo '<form class="pme-form" method="POST" action="' .$PHP_SELF.'" name="form1">';
echo '<input type="hidden" name="delete_rq" value="N">',"\n";

// building the array of checked entries if any checkboxes are selected and delete button was previously pressed

$id_checked=array();
if (is_array($HTTP_POST_VARS)) {
  if ($HTTP_POST_VARS['delete_rq'] == 'Y') {
    foreach ($HTTP_POST_VARS as $k => $v) {
      if (!is_array($v)) {
        if (strncmp($k,'checked',7)==0){
          $id_checked[]=substr($k,7);
        }}}}
}

// deleting the array of checked entries if delete button was pressed and 'delete confirmed' security checkbox was checked

if ((!empty($id_checked)) && ($HTTP_POST_VARS['delete_rq'] == 'Y') && ($HTTP_POST_VARS['delconfirm']=='yes')){
  $dbcon = @mysql_pconnect($opts['hn'], $opts['un'], $opts['pw']);
  if ($dbcon){
    foreach ($id_checked as $id) {
      $mqry = 'delete from ' .$opts['tb']. ' where ' .$opts['key'].'='.$id ;
      $res = @mysql_db_query($opts['db'], $mqry, $dbcon);
      if (!$res) {
        die('Error 2');
      }
    }
    @mysql_close($dbcon);
  }
  else {
    die('Error 1');
  }
}

//  unsetting delete variables

  unset($id_checked);
  unset($dbcon);
  unset($res);
  unset($mqry);


4) add this after a call to phpMyEdit (this part adds delete button, confirm delete checkbox, and finished the form element:

Kód:

<fieldset>
<table class="pme-navigation">
  <tr class="pme-navigation">
    <td class="pme-buttons" align="right"><input type="checkbox" name="delconfirm" id="delconfirm" value="yes">
      <label for="delconfirm">Confirm deletion!</label>
      <br/>
      <input class="pme-sub" type="submit" value="Delete checked" onClick="this.form.delete_rq.value='Y';">
    </td>
  </tr>
</table>
</fieldset>
</form>



Hope this helps.

One important thing: Most of the code above was taken by me somewhere on the Internet or even this forum (unfortunately, I just don't remember), so by giving this statement I want to make clear that I don't claim the ownership of the code above and that credits go to the person who actually created it.

Dan

 
hsicard     Založený: 22.10.2003   Príspevky: 17  
Príspevok Zaslal: 2007-12-14 20:09
Návrat hore  Odpovedať s citátom     

Dan,
Thank you so much for this compilation of code. It works really great, and I will be able to build many features thanks to this system.
Thanks again. Regards,
Hugues

 
nkt     Založený: 16.05.2008   Príspevky: 14  
Príspevok Zaslal: 2008-06-07 00:49
Návrat hore  Odpovedať s citátom     

Hi All,

First of all thanks a lot for this code. I also wanted to have check boxes for Delete and Edit Multiple records.

I tried the code as it is , It does print the check-box and Delete button but it does not delete the records.

 
cmeladia     Založený: 20.11.2011   Príspevky: 1  
Príspevok Zaslal: 2011-11-21 19:53
Návrat hore  Odpovedať s citátom     

Kód:

// Adding a form element and 'delete_request' field

echo '<form class="pme-form" method="POST" action="' .$PHP_SELF.'" name="form1">';
echo '<input type="hidden" name="delete_rq" value="N">',"\n";

// building the array of checked entries if any checkboxes are selected and delete button was previously pressed

$id_checked=array();
if (is_array($_POST)) {
  if (isset($_POST['delete_rq']) && $_POST['delete_rq'] == 'Y') {
    foreach ($_POST as $k => $v) {
      if (!is_array($v)) {
        if (strncmp($k,'checked',7)==0){
          $id_checked[]=substr($k,7);
        }}}}
}

// deleting the array of checked entries if delete button was pressed and 'delete confirmed' security checkbox was checked

if ((!empty($id_checked)) && ($_POST['delete_rq'] == 'Y') && (isset($_POST['delconfirm']) && $_POST['delconfirm']=='yes')){
  $dbcon = @mysql_pconnect($opts['hn'], $opts['un'], $opts['pw']);
  if ($dbcon){
    foreach ($id_checked as $id) {
      $mqry = 'delete from ' .$opts['tb']. ' where ' .$opts['key'].'='.$id ;
      $res = @mysql_db_query($opts['db'], $mqry, $dbcon);
      if (!$res) {
        die('Error 2');
      }
    }
    @mysql_close($dbcon);
  }
  else {
    die('Error 1');
  }
}

//  unsetting delete variables

  unset($id_checked);
  unset($dbcon);
  unset($res);
  unset($mqry);


 
davidmartin4797     Založený: 03.12.2019   Príspevky: 61  
Príspevok Zaslal: 2020-09-15 07:22
Návrat hore  Odpovedať s citátom     

On a more extensive point of view, Geek Squad Online Support currently analyze specialized issues and issues, and repairs all buyer gadgets, including apparatuses. Our technical support and association is extending at full-fledge to keep an adjustment with consistently changing innovation around the globe. Geek Squad Online Support leads on the planet, with regards to give tech services to PC, home repair, gadgets and so on. We offer help for more than 2 million clients. Being one of the subsidiaries of Best Buy, an American buyer hardware organization.

For more information visit site :- Geek Squad tech support

Geek Squad chat

 
florahwilliams     Založený: 18.03.2020   Príspevky: 18  
Príspevok Zaslal: 2020-09-22 05:53
Návrat hore  Odpovedať s citátom     

Entrepreneurship research writing services are essential for entrepreneurship coursework writing service students and Entrepreneurship Essay Writing Services seekers.
https://researchpapers247.com/entrepreneurship-essay-writing-services/

 
davidmartin4797     Založený: 03.12.2019   Príspevky: 61  
Príspevok Zaslal: 2020-11-30 07:40
Návrat hore  Odpovedať s citátom     

The Geek Squad brand itself was fun and irreverent, and Agents were easily identifiable by their badges, black pants, white shirts, break-away ties and signature GeekMobiles&#8482; (the first car was a 1958 Simca Aronde 1300 Elysee!). In a short time, the iconic orange, black and white Geek Squad logo became a well-known symbol of tech help in the communities it served.

For more information visit site :- Geek Squad tech support

Geek Squad tech support

Geek Squad appointment

Geek Squad chat

 
kimchiimg     Založený: 26.12.2020   Príspevky: 1  
Príspevok Zaslal: 2020-12-26 08:32
Návrat hore  Odpovedať s citátom     

Thanks for writing such a good article
resize image

 
davidmartin4797     Založený: 03.12.2019   Príspevky: 61  
Príspevok Zaslal: 2021-03-20 08:41
Návrat hore  Odpovedať s citátom     

We use only original parts in case of replacement. Geek Squad will assist in everything that you use on daily basis. Any customer and client of Geek Squad can schedule their personal support at any time according to their space.

For more information visit site :- Geek Squad tech support

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov