On Mon, 26 Feb 2001 13:20, Peter Houchin wrote:
> I'm playing aruond with the switch statement trying to get one to work
> for $submit
> I have 2 forms on the one page (only one displays at a time) 1 is for
> creating a new record in my data base the other is for
> updating/changing values from the first form should there be any. So i
> want it to switch between the 2 cases

OK. Suppose the possible values for $submit are 'insert' and 'update'. [I 
assume those are values _you_ can assign to a submit button]

Then

switch($submit) {

case 'insert':
  // Your insert stuff here
  break; //So it doesn't fall through to the next case

case 'update:
  // Your update stuff here
  break;

case default:
  // The page has somehow been called without a value (or an
  // inappropriate value) for submit
  // Error handling or whatever here

}

Does that make it clearer? or muddier :-)

-- 
David Robley                        | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES  | http://www.nisu.flinders.edu.au/
AusEinet                            | http://auseinet.flinders.edu.au/
            Flinders University, ADELAIDE, SOUTH AUSTRALIA

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to