User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,904 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,108 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 907 | Replies: 4
Reply
Join Date: Aug 2004
Posts: 18
Reputation: ray_broome is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
ray_broome ray_broome is offline Offline
Newbie Poster

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

  #1  
Dec 5th, 2007
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2005
Location: New York state
Posts: 458
Reputation: ShawnCplus will become famous soon enough ShawnCplus will become famous soon enough 
Rep Power: 5
Solved Threads: 68
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

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

  #2  
Dec 5th, 2007
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.
GCS d- s+:+ a-->? C++(++++) UL+++ P+>+++ L+++ !E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r z+*
Reply With Quote  
Join Date: Aug 2004
Posts: 18
Reputation: ray_broome is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
ray_broome ray_broome is offline Offline
Newbie Poster

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

  #3  
Dec 5th, 2007
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.
Reply With Quote  
Join Date: Apr 2005
Location: New York state
Posts: 458
Reputation: ShawnCplus will become famous soon enough ShawnCplus will become famous soon enough 
Rep Power: 5
Solved Threads: 68
Sponsor
ShawnCplus's Avatar
ShawnCplus ShawnCplus is offline Offline
Code Monkey

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

  #4  
Dec 5th, 2007
var blah = document.getElementById(<textbox id>);
if(blah.value == "")
  alert("blah is empty");
GCS d- s+:+ a-->? C++(++++) UL+++ P+>+++ L+++ !E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r z+*
Reply With Quote  
Join Date: Nov 2007
Location: Bangalore, India
Posts: 3,098
Reputation: nav33n has a spectacular aura about nav33n has a spectacular aura about 
Rep Power: 8
Solved Threads: 239
nav33n's Avatar
nav33n nav33n is offline Offline
Posting Sensei

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

  #5  
Dec 6th, 2007
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.
  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. }
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

*PM asking for help will be ignored*
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 3:26 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC