Skip to main content
New Participant
December 31, 2006
Question

Update record validation

  • December 31, 2006
  • 2 replies
  • 422 views
I've used DW insert app object to build form to update a record. I'd like to add an if statement but I am unsure where to insert the code. I want to check a field for a specific value before letting the record be updated. If the value is equal to a specific value the form is process otherwise the entire update is cancelled.

Thanks
This topic has been closed for replies.

2 replies

Inspiring
January 3, 2007
rozebiz wrote:
> I've used DW insert app object to build form to update a record. I'd like to
> add an if statement but I am unsure where to insert the code. I want to check
> a field for a specific value before letting the record be updated. If the value
> is equal to a specific value the form is process otherwise the entire update is
> cancelled.

The PHP code that controls the update begins with this line ("form1"
will be whatever name the update form has):

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {

Place your cursor at the end of that line and press enter a couple of
times to insert space for the following code:

if ($_POST['myVariable'] != 'required_value') {
// code to inform user that update has not been done
}
else {

Then scroll down until you find this code:

header(sprintf("Location: %s", $updateGoTo));
}

Insert another closing curly brace immediately after it to balance the
opening one after "else".

Replace 'myVariable' and 'required_value' with the field that you want
to check and the value it needs to be.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Inspiring
January 2, 2007
What langauage are you using?

--
Paul Whitham
Certified Dreamweaver MX2004 Professional
Adobe Community Expert - Dreamweaver

Valleybiz Internet Design
www.valleybiz.net

"rozebiz" <webforumsuser@macromedia.com> wrote in message
news:en8oua$ni0$1@forums.macromedia.com...
> I've used DW insert app object to build form to update a record. I'd like
> to
> add an if statement but I am unsure where to insert the code. I want to
> check
> a field for a specific value before letting the record be updated. If the
> value
> is equal to a specific value the form is process otherwise the entire
> update is
> cancelled.
>
> Thanks
>


rozebizAuthor
New Participant
January 3, 2007
Sorry forgot to mention PHP