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


splitting <SELECT> drop down values

Thread began 4/21/2015 1:38 pm by rob75685 | Last modified 4/22/2015 3:14 pm by Ray Borduin | 642 views | 2 replies |


splitting <SELECT> drop down values

hi guys

Sorry for posting a question that has undoubtedly been answered many times before... I'm just a bit stuck trying to figure it out.

I have a <SELECT> list, which brings in values from the database - the option name and the price ($row_rstGetOptions)

I can get the name to bind to $ATC_itemName, but can't get the price to bind to $ATC_itemPrice as the price comes from the same <SELECT> list...

Here's my relevant code, thanks for all your help:

$ATC_itemID = $_POST["eCart1_1_ID_Add"];
$ATC_AddIfIn = 2;
$ATC_RedirectAfter = "cart.php";
$ATC_RedirectIfIn = "";
if (isset($totalRows_rstProduct) && $totalRows_rstProduct > 0) {
$row_rstProduct = WAEC_findRecordMySQL($rstProduct, "product_ID", $ATC_itemID);
if ($row_rstProduct) {
$ATC_itemName = "".$row_rstProduct['name'] ." - ". $row_rstGetOptions['option'] . "";// column binding
$ATC_itemDescription = "";// column binding
$ATC_itemThumbnail = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = "".$_POST["eCart1_1_Quantity_Add"] ."";// column binding
$ATC_itemPrice = "".$_POST["eCart1_1_Price_Add"] ."";// column binding

<select name="eCart1_1_Price_Add">
do {
<option value="<?php echo $row_rstGetOptions['price']?>"><?php echo $row_rstGetOptions['option']?></option>
} while ($row_rstGetOptions = mysql_fetch_assoc($rstGetOptions));
$rows = mysql_num_rows($rstGetOptions);
if($rows > 0) {
mysql_data_seek($rstGetOptions, 0);
$row_rstGetOptions = mysql_fetch_assoc($rstGetOptions);

Sign in to reply to this post

Ray BorduinWebAssist

I would probably set the value of the list to the ID column from the database. Then create a second recordset to look up the row based on the submitted ID. That way you would have access to any of the fields in that row through the second recordset.

Sign in to reply to this post


thanks for your help Ray - not sure place to place that recordset though...

I've set the select list value to the Options Recordset ID :

<option value="<?php echo $row_rstGetOptions['option_ID']?>">

then created a recordset to pull in the posted value:

I've put it before the Add To Cart behaviour:

$colname_rstGetOption = "-1";
if (isset($_POST['option_ID'])) {
$colname_rstGetOption = $_POST['option_ID'];
mysql_select_db($database_hayward, $hayward);
$query_rstGetOption = sprintf("SELECT * FROM OPTIONS WHERE option_ID = %s", GetSQLValueString($colname_rstGetOption, "int"));
$rstGetOption = mysql_query($query_rstGetOption, $hayward) or die(mysql_error());
$row_rstGetOption = mysql_fetch_assoc($rstGetOption);
$totalRows_rstGetOption = mysql_num_rows($rstGetOption);

then set the add to cart code to bring in those recordset values

$ATC_itemName = "".$row_rstProduct['name'] ." - ". $row_rstGetOption['option'] . "";// column binding
$ATC_itemDescription = "";// column binding
$ATC_itemThumbnail = "";// column binding
$ATC_itemWeight = floatval("0");// column binding
$ATC_itemQuantity = "".$_POST["eCart1_1_Quantity_Add"] ."";// column binding
$ATC_itemPrice = "".$row_rstGetOption['price'] ."";// column binding

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





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