close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Server Validation if Recordset not empty

Thread began 2/21/2012 5:36 pm by toni272059 | Last modified 5/27/2014 10:45 am by toni272059 | 5432 views | 14 replies


Server Validation if Recordset not empty

Working on order form for product_details.php that shows options for Embroidery ONLY for some Products.

I have successfully setup the Select Option to Show if Recordset not empty. So in the case of products that do not offer Embroidery the Select Options are hidden.

Next I added 2 validations, one to select from a list of colors and one to select Embroidery or Plain.

Problem is all Products pass thru the detail_products.php before being Added to Cart. So the page will not validate when there is no selection for Embroidery even though to the customer the option is not available. All they see is the Validation Show if error message and the item is not added to Shopping Cart

I have read various posts about using the
<?php if ($totalRows_rsEmbroidery > 0) { // Show if recordset not empty ?>
and tried putting around WAFV code but result is an error message about an undefined variable.

Follows the php for Form Validation with the added <?php if ($totalRows.....
if (isset($_POST["eCart1_1_ATC_x"])) {
$WAFV_Redirect = "";
$_SESSION['WAVT_productdetail_366_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["eCart1_1_Color_Add"]))?$_POST["eCart1_1_Color_Add"]:"") . "",true,1);
if ($totalRows_rsEmbroidery > 0) {
$WAFV_Errors .= WAValidateRQ(((isset($_POST["eCart1_1_Embroidery_Add"]))?$_POST["eCart1_1_Embroidery_Add"]:"") . "",true,2);
if ($WAFV_Errors != "") {

And code for Form Select
<?php if ($totalRows_rsEmbroidery > 0) { // Show if recordset not empty ?>
<select name="eCart1_1_Embroidery_Add">
<option value="">Select Embroidery Option</option>
do {
<option value="<?php echo $row_rsEmbroidery['ProductOptionID']?>"><?php echo $row_rsEmbroidery['OptionName']?></option>
} while ($row_rsEmbroidery = mysql_fetch_assoc($rsEmbroidery));
$rows = mysql_num_rows($rsEmbroidery);
if($rows > 0) {
mysql_data_seek($rsEmbroidery, 0);
$row_rsEmbroidery = mysql_fetch_assoc($rsEmbroidery);
<?php } // Show if recordset not empty ?></td>

And code for Validation Show if
if (ValidatedField('productdetail_366','productdetail_366')) {
if ((strpos((",".ValidatedField("productdetail_366","productdetail_366").","), "," . "2" . ",") !== false || "2" == "")) {
if (!(false)) {
<span style="color: #d73436">Please select an Embroidery Option</span> <br />
<?php //WAFV_Conditional product_detail.php productdetail_366(2:) <-- not a smiley face should be colon and closing bracket.

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





Ease of use


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...