Skip to main content
Inspiring
January 19, 2007
Question

Insert & Update On same page?

  • January 19, 2007
  • 11 replies
  • 642 views
With the new version 8.0.2, is it possible to get both an insert and an
update on the same page?

I've tried it and the code seems to run into itself because the Insert
shares function names with Update.

I've tried giving them different names but this doesn't work.

Any ideas? Suggestions?

Thanks
This topic has been closed for replies.

11 replies

Inspiring
January 19, 2007
On Fri, 19 Jan 2007 08:26:47 -0600, Lee <lee_nospam_@artjunky.com>
wrote:

>With the new version 8.0.2, is it possible to get both an insert and an
>update on the same page?
>
>I've tried it and the code seems to run into itself because the Insert
>shares function names with Update.
>
>I've tried giving them different names but this doesn't work.

Tried giving what different names - the forms?

I use a hidden variable in each form and test for it in the $_POST
array. The insert form (which I would call frmInsert) would have a
hidden variable called (for example) DB_INSERT and a value of
frmInsert. Similarly, the update form (frmUpdate) might have a hidden
variable named DB_UPDATE with a value of frmUpdate.

Then you control the flow in this way:

<?php

if ( isset($_POST['DB_INSERT') && $_POST['DB_INSERT'] == 'frmInsert' )
{

// your insert code here

} else if ( isset($_POST['DB_UPDATE') && $_POST['DB_UPDATE'] ==
'frmUpdate' ) {

//your update code here

}

?>
--
Steve
steve at flyingtigerwebdesign dot com