Re: PHP DB Interaction with Javascript?

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

 



"Aaron Wolski" <aaronjw@martekbiz.com> wrote in message
000a01c33c0b$aa3199b0$0203a8c0@AJW2">news:000a01c33c0b$aa3199b0$0203a8c0@AJW2...
> Hi All,
>
> Trying to get my head around something and want to know if it's possible
> first.
>
> Can PHP and Javascript interact to the point of PHP querying a DB to
> find out what records are in use as a variable for another record and
> then using JS to A) prevent the user from clicking a delete button; or
> B) pop-up a notice telling the user they can delete that particular
> record.
>
> Hope that makes sense.. any ideas?

Sure it does!

You looking to use PHP to query a database, create a table (or something)
and give the user the ability to dealte [or not] a particular record from
the displayed info.

Snce you havn't told us how your displaying your data, nor how a user can
kill a record, I will make some assumptions and you can go from there.

I would display this info ina table stlye, rows and columns to dispaly the
data from the database.


Each row would have a checkbox on it so I can select several items at once
and then have a DELETE button at the bottom and all the selected records
will go away.

Or you can place a DELETE button on EACH row to remove that particular
record right then.

Either way works.

So now the question, how can server-side PHP tell client-side JS that this
record can be modified and that record can not?

Right?

Simple, add a DISABLED attribute to the checkbox or individual record DELETE
button (as descirbed above). If something in your record from the database
says that this particular record can NOT be edited, then add the DISABLED
aatribute to the Form Element (checkbox or button).

And on the client-side, the HTML will take care of letting the user kill a
record or not.

Does this help?

walter




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux