RE: [PHP] Dynamic form changes without refresh
| From: | Per Jessen | Date: | Thu, 05 Jun 2008 12:50:37 +0000 |
| Subject: | RE: [PHP] Dynamic form changes without refresh | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-275058@lists.php.net to get a copy of this message | ||
Mayer, Jonathan wrote:
> I suppose that, as well as updating the database when I click the
> link, I could also update a CSS toggle, but I'd really like it to be
> deciding whether to toggle only based on the flag in the database.
>
> So:
>
> // check database
> if ($toggle == 1)
> {
> <textarea>...</textarea>
> }
> else
> {
> <textarea disabled>...</textarea>
> }
>
> This is called every time the page is refreshed, of course, but if the
> database is changed afterwards, the form doesn't know. I would like
> some way of continually checking in the background whether $toggle is
> 1 or 0, and update the form appropriately. I assumed AJAX was the way
> to go.
Ajax or iframe-rpc would work, yes. Continually poll your database and
set the display attribute accordingly.
/Per Jessen, Zürich