Re: Query String

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi friend.. 

I think this will work for you.

Execute this code:

/* beginning of file */

<?php
if( isset($_POST['submit']) ) {
if( empty($_POST['mycheckbox']) ) {
    echo '<h2>No checkbox selected</h2>';
    } else {
    echo '<strong>Query to Delete Items:</strong><br />';
        foreach( $_POST['mycheckbox'] as $value ) {
        $deleteSql = 'DELETE FROM `myTable` WHERE `myTable`.`my_id` = ' . $value;
        echo $deleteSql . '<br>';
        }
    }
}
?>
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Example</title>
</head>

<body>

<h2>Check the items to delete:</h2>
<form id="form1" name="form1" method="post" action="">
  <blockquote>
      <input type="checkbox" name="mycheckbox[]" id="mycheckbox" value="1" />Item 1<br />
      <input type="checkbox" name="mycheckbox[]" id="mycheckbox" value="2" />Item 2<br />
      <input type="checkbox" name="mycheckbox[]" id="mycheckbox" value="3" />Item 3<br />
      <input type="checkbox" name="mycheckbox[]" id="mycheckbox" value="4" />Item 4<br />
      <input type="checkbox" name="mycheckbox[]" id="mycheckbox" value="5" />Item 5<br />
      <input type="checkbox" name="mycheckbox[]" id="mycheckbox" value="6" />Item 6<br />
      <input type="checkbox" name="mycheckbox[]" id="mycheckbox" value="7" />Item 7<br />
      <input type="checkbox" name="mycheckbox[]" id="mycheckbox" value="8" />Item 8<br /><br />
  </blockquote>
      <input type="submit" name="submit" id="submit" value=" Delete Selected Items " />
</form>
</body>
</html>

/* end of file */

Hope this will work for you *-*

Joseph Griffin
http://www.aspiredmind.com




________________________________
From: Sovichea SOU <svch_sou@xxxxxxxxxxx>
To: php-objects@xxxxxxxxxxxxxxx
Sent: Sat, January 23, 2010 4:22:45 PM
Subject: Re:  Query String

Hi, thanks for your reply.

I have multi check boxes loop with data from database.
I want to delete many records at the same time.

Any ideas?

Vichea

On Sat, Jan 23, 2010 at 11:47 AM, Behn00sh MoshtaGH <euruse@xxxxxxxxx>wrote:

>
>
> Hi
> you shouldn't use querystring in that way.
> i suggest this:
> http://localhost/news/index.php?*cID=56534/56581/**56587*&submit=Verify
> and then
> $id=$_REQUEST[cID];
>
> thesn splite $id
>
>
> On Sat, Jan 23, 2010 at 6:14 AM, Sovichea SOU <svch_sou@xxxxxxxxxxx<svch_sou%40yahoo.co.uk>>
> wrote:
>
> >
> >
> > Hi,
> >
> > I want to delete multi records where id=5653, 56581,and 56587.
> >
> >
> http://localhost/news/index.php?cID=56534&cID=56581&cID=56587&submit=Verify
> >
> > how to split cID from the url?
> > how to delete those records?
> >
> > Many thanks
> >
> > Vichea
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
>
> --
>
> Behn00sh Moshtagh
> --~--~---------~--~----~------------~-------~--~--
>
> [Non-text portions of this message have been removed]
>
>  
>



-- 
Sovichea SOU
Email: chhit@xxxxxxxxx
          sovichea@xxxxxxxxxx
Website: www.chhit.com - www.sovichea.info


[Non-text portions of this message have been removed]



------------------------------------

Are you looking for a PHP job?
Join the PHP Professionals directory Now!
http://www.phpclasses.org/jobs/
Yahoo! Groups Links



[Non-text portions of this message have been removed]


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux