artist has asked for the wisdom of the Perl Monks concerning the following question:
For example, sulfericacid like to design a system to add/remove email addresses via CGI form based upon if users have provided proper fields and email address exists or not in the database. While talking in CB, I created the truth table.
name email add emailexist step: T T T T warn 1. email exists in database T T T F action 1: add email in database T T F T action 2: remove email from database T T F F warn 2. email doesn't exist in database T F - - warn 3. email empty F T - - warn 4. name empty F F - - warn 5. name and email emptyNotes:
Name: 'T' If user has provided name Email: 'T' If user has provided email Add: 'T' if radio button for 'add' is checked. (other option is to remove Emailexist: 'T' if email exists in the database - : It's not relavent.Sample code
if(form){ if(name){ if(email){ if(option=add){ if(stored){ warn1:email exists } else{ action:add email } } else(option=remove){ if(stored){ action:remove email } else{ warn2: email doesn't exist } } } else{ warn3: email empty } }else{ if(email){ warn4: name empty } else{ warn5: name and email empty } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Code generation from truth table.
by dragonchild (Archbishop) on Apr 09, 2003 at 17:04 UTC | |
|
Re: Code generation from truth table.
by l2kashe (Deacon) on Apr 09, 2003 at 17:26 UTC | |
by mojotoad (Monsignor) on Apr 10, 2003 at 06:55 UTC |