Re: Re: Query String

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

 



That is really helpful. Thanks you Shadow Caster.


Vichea

On Tue, Jan 26, 2010 at 5:36 AM, shadow <shadow3dcaster@xxxxxxxxxxx> wrote:

>
>
>
>
> Hello Vichea,
>
> In your HTML you should have form fields with names indicating that they
> are an array by using square brackets [] after the name - something like
> this:
>
> <form method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
> <input type="checkbox" name="id[]" value="a" /> a
> <input type="checkbox" name="id[]" value="b" /> b
> <input type="checkbox" name="id[]" value="c" /> c
> <input type="checkbox" name="id[]" value="d" /> d
> <input type="submit" name="submit" />
> </form>
>
> When the submit button is clicked it creates a URI query string something
> like this:
>
> /path/to/page.php?id[]=a&id[]=b&id[]=c&submit=Submit+Query
>
> Then in your PHP script you can treat $_GET['id'] as an array with such
> constructs as 'foreach' and the various array functions. But if you want to
> run the delete SQL command try something like this (remembering to eradicate
> SQL injection, empty arrays and non-array objects first):
>
> $ids = substr(implode(',', $_GET['id']), 0, -1);
> $query = mysql_query("DELETE FROM table_name WHERE id IN ($ids)") or
> die(mysql_error());
>
> That should do it. I hope this helps.
>
> -- Shadow Caster
>
>
> --- In php-objects@xxxxxxxxxxxxxxx <php-objects%40yahoogroups.com>,
> Sovichea SOU <svch_sou@...> 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]
> >
>
>  
>



-- 
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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/php-objects/join
    (Yahoo! ID required)

<*> To change settings via email:
    php-objects-digest@xxxxxxxxxxxxxxx 
    php-objects-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/


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

  Powered by Linux