close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

If validation on Update

Thread began 8/25/2015 6:37 am by georgina_barrett_187762 | Last modified 8/25/2015 1:48 pm by Ray Borduin | 234 views | 4 replies |

georgina_barrett_187762

If validation on Update

I am trying to put a bit of validation on my update form. I only want the user to update the database if...
1) If the field 'New' (checkbox) = 'Cancelled' the field 'booked' cannot be null
AND
2) If the field 'trafficlight'(select) = 'G' the field 'booked' cannot be null

This is my code.. but it still updates the database even if the criteria isn't met.
// WA DataAssist Update
if ((isset($_POST["Update"]) || isset($_POST["Update_x"])) && (($_POST["New"]=='Cancelled' && isset($_POST["booked"]))
|| empty($_POST["New"])) && (($_POST["trafficlight"]=='G' && isset($_POST["booked"])) || $_POST["trafficlight"]!='G')) // Trigger

Sign in to reply to this post

Ray BorduinWebAssist

What type of field is "booked"?

Sign in to reply to this post

georgina_barrett_187762

a text field

Sign in to reply to this post

Ray BorduinWebAssist

Then it will always be set even if it is blank... you can't use isset() to check if it is blank.

Use empty() instead.

Sign in to reply to this post

georgina_barrett_187762

Thanks!

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...