close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Checkout Shipping Options if statement

Thread began 3/11/2010 3:26 pm by merlin28086 | Last modified 3/11/2010 5:22 pm by Eric Mittman | 610 views | 1 replies |

merlin28086

Checkout Shipping Options if statement

I am trying to list 2 sets of options for shipping to our customers. Each draws from a recordset in the shipping tables. I want the US options to show up if the customer is in the US and all other options to show up if the customer is international based on a boolean in the shipping table that marks options as US.

My code isn't working. Both options show up no matter what the country ID is in the customer's table. It looks like a simple statement would work, but I'm not proficient in PHP.
What am I doing wrong?

------begin-----------

<?php if ($row_WAATKcustomers['CountryID'] != 236) { // Show if recordset not empty ?>
<select name="shipTypeList" id="shipTypeList">
<option value="">Choose Shipping</option>
<?php
do {
?>
<option value="<?php echo $row_rsShipTypeList['ShipTypeID']?>"><?php echo $row_rsShipTypeList['ShipTypeName']?></option>
<?php
} while ($row_rsShipTypeList = mysql_fetch_assoc($rsShipTypeList));
$rows = mysql_num_rows($rsShipTypeList);
if($rows > 0) {
mysql_data_seek($rsShipTypeList, 0);
$row_rsShipTypeList = mysql_fetch_assoc($rsShipTypeList);
}
?>
</select>
<?php } // Show if recordset not empty ?>

<?php if ($row_WAATKcustomers['CountryID'] = 236) { // Show if recordset not empty ?>

<select name="shipTypeList" id="shipTypeList">
<option value="">Choose Shipping</option>
<?php
do {
?>
<option value="<?php echo $row_rsShipTypeUS['ShipTypeID']?>"><?php echo $row_rsShipTypeUS['ShipTypeName']?></option>
<?php
} while ($row_rsShipTypeUS = mysql_fetch_assoc($rsShipTypeUS));
$rows = mysql_num_rows($rsShipTypeUS);
if($rows > 0) {
mysql_data_seek($rsShipTypeUS, 0);
$row_rsShipTypeUS = mysql_fetch_assoc($rsShipTypeUS);
}
?>
</select>
<?php } // Show if recordset not empty ?>

--end -

Sign in to reply to this post

Eric Mittman

The problem looks to be how your second if statement is formed, you have it like this:

php:
<?php if ($row_WAATKcustomers['CountryID'] = 236) { // Show if recordset not empty ?>



This is not comparing the countryID to 236, you are trying to set it to 236. The code after this if statement will execute always regardless. You need to update this to check if it is equal to this value like this:

php:
<?php if ($row_WAATKcustomers['CountryID'] == 236) { // Show if recordset not empty ?>
or
<?php if ($row_WAATKcustomers['CountryID'] == '236') { // Show if recordset not empty ?>
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...