Re: Avoid 'GET' method
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: Avoid 'GET' method

From: Tony Marston <tony@NOSPAM.demon.co.uk>
Date: Tue Jul 19 2005 - 10:55:45 CEST

First, always use the POST method to update the database.

Second, do not put a separate set of buttons against each entry, use a
single set for the whole page. Put a checkbox against each entry so that the
user may select one or more entries, then when a button is pressed it
performs that action against those selected entries. Take a look at
http://www.tonymarston.co.uk/sample/person_list.php for an example.

This is part of my sample application
(http://www.tonymarston.net/php-mysql/sample-application.html) which you can
download to run locally.

-- 
Tony Marston
http://www.tonymarston.net
"Gordon Burditt" <gordonb.qy408@burditt.org> wrote in message 
news:11dnud15psilqe5@corp.supernews.com...
>>> Is there a way to make a text link post
>>
>>no, you can't make a link *do* anything.
>
> Yes, you can, but it's debatable as to whether it's a good idea.
> For example, you might have a link labelled 'Delete' next to
> a listing for a user on the editusers.php page:
> http://my.domain.com/admin/editusers.php?mode=delete&userid=7362
> and clicking on it deletes the user in question.  (Obviously some kind
> of authentication is in use for this, and maybe it takes you to a
> confirmation page).
>
> I'd be interested in someone's idea for a solution to the general
> problem:  you have a table with possibly hundreds or thousands of
> lines in it.  You want to have several clickable things on *each
> line* that do stuff to the item (say, a DNS record) in question
> (edit, delete, disable, enable, whatever).  I've been using GET
> with links that have a mode variable and some kind of id variable.
> Disadvantages:  running linkchecker on this destroys the database,
> given that it effectively clicks on every delete button.
>
> I've considered using PUT with forms with hidden fields instead.
> Disadvantages: (a) the submit buttons tend to be too darn big,
> making viewing enough of the table at one time impossible, and (b)
> browsers tend to run out of memory much faster with a thousand forms
> rather than a thousand links, and (c) a page with lots of forms is
> a lot longer in HTML than a page with lots of links, making load
> times noticible.
>
> Gordon L. Burditt 
Received on Mon Oct 17 21:10:39 2005