Hi,

I am trying to create a 'simple' admin page where certain (authorized) people can update data in the database or add new info to it. The issue i've run into is after i created the form and have all the fields how do i tell which one(s) the user has typed into/edited so i can use that info in a query.

I was thinking i might need to use the onchange event but not sure how i'd track each field that was changed and then update only those, i even checked some of phpmyadmin's code to see how they do it but couldnt really figure it out.

Help plz

Well that's more of a PHP thing, not so much with JavaScript. You can't do alot(anything?) in Javascript to interact with a database.

well the thing is i'm not interacting with the database at this point. The 'fields' i'm referring to are the html form fields where a user would type things such as a name, etc.

e.g. If i had:

Search for a Plant to update:
Scientific Name _____
Common Name _____
[Search]

How do i tell which field the user has typed in here (sci name/com name or both) so that i can pass that text into a query later on.

You can just validate it through javascript(Or to check if that field has some value or not.) But, Its much easier if you do it in php. eg.

if(isset($_POST['sci_name'])){
echo "Scientific name is ". $_POST['sci_name'];
}
if(isset($_POST['name'])){
echo "General name is ". $_POST['name'];
}
This article has been dead for over six months. Start a new discussion instead.