Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Update record validation

New Here ,
Dec 31, 2006 Dec 31, 2006
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
TOPICS
Server side applications
434
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 02, 2007 Jan 02, 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
>


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2007 Jan 02, 2007
Sorry forgot to mention PHP
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 03, 2007 Jan 03, 2007
LATEST
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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines