form validation then update sql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
AXEmonster
Forum Commoner
Posts: 34
Joined: Fri Sep 05, 2003 11:27 am
Location: newcastle UK

form validation then update sql

Post by AXEmonster »

hi guys
can some one give me an idea how to do the following

three form fields.

if 1 or 2 of the form fields have a value use this sql update statment

if all 3 have a value use this sql update statment

------------

would i be right in collecting form content into an array and counting array

**using mysql as backend**
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Luckily, the form content is already in an array - either $_POST or $_GET. Just counting that array would be the easiest way I can think of. The only difficulty I can think of is that if the form variables are used in the query, you may not be certain which ones are filled in. You're still going to have to do checks against specific form values.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply