943,559 Members | Top Members by Rank

Ad:
Dec 5th, 2007
0

trying to create a 'simple' admin page to update mysql dbase

Expand Post »
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
Reputation Points: 10
Solved Threads: 0
Light Poster
ray_broome is offline Offline
25 posts
since Aug 2004
Dec 5th, 2007
0

Re: trying to create a 'simple' admin page to update mysql dbase

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.
Sponsor
Reputation Points: 520
Solved Threads: 268
Code Monkey
ShawnCplus is offline Offline
1,564 posts
since Apr 2005
Dec 5th, 2007
0

Re: trying to create a 'simple' admin page to update mysql dbase

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:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. Search for a Plant to update:
  2. Scientific Name _____
  3. Common Name _____
  4. [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.
Reputation Points: 10
Solved Threads: 0
Light Poster
ray_broome is offline Offline
25 posts
since Aug 2004
Dec 5th, 2007
0

Re: trying to create a 'simple' admin page to update mysql dbase

JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. var blah = document.getElementById(<textbox id>);
  2. if(blah.value == "")
  3. alert("blah is empty");
Sponsor
Reputation Points: 520
Solved Threads: 268
Code Monkey
ShawnCplus is offline Offline
1,564 posts
since Apr 2005
Dec 6th, 2007
0

Re: trying to create a 'simple' admin page to update mysql dbase

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.
php Syntax (Toggle Plain Text)
  1. if(isset($_POST['sci_name'])){
  2. echo "Scientific name is ". $_POST['sci_name'];
  3. }
  4. if(isset($_POST['name'])){
  5. echo "General name is ". $_POST['name'];
  6. }
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: cant get the spacing on menu bottons to change
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: JavaScript not working in Internet Explorer 7





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC