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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Not sure this is the right tool

Thread began 7/17/2009 9:37 pm by bjgarner241692 | Last modified 7/20/2009 2:33 pm by bjgarner241692 | 2211 views | 3 replies |

bjgarner241692

Not sure this is the right tool

My Select List is only one level deep.
It calls one field from a recordset to be used as a URL parameter in the results page.
It works fine, except that I need it to start with a Static Value such as "Select by Product"
When the viewer picks a product out of the dropdown, it submits the form and loads the next page. At present, the initially selected value, which is essentially the last record in the table, will not fire the form.

Here is my Select Code:

<select onchange="this.form.submit();" name="product" id="product" width="160" style="width: 160px">
<option value="" <?php if (!(strcmp("", $row_prods['ID']))) {echo "selected=\"selected\"";} ?>>Search by Product</option>
<?php
do {
?>
<option value="<?php echo $row_prods['ID']?>"<?php if (!(strcmp($row_prods['ID'], $row_prods['ID']))) {echo "selected=\"selected\"";} ?>><?php echo $row_prods['Name']?></option>
<?php
} while ($row_prods = mysql_fetch_assoc($prods));
$rows = mysql_num_rows($prods);
if($rows > 0) {
mysql_data_seek($prods, 0);
$row_prods = mysql_fetch_assoc($prods);
}
?>
</select>

From my understanding of Dynamic Dropdowns, I would only use it if I wanted to filter the prods table by option or some other table. That is not the case in this instance.

Actually, I've run across this same challenge countless times and have not found a resolution.

Any help would be appreciated.

Sign in to reply to this post

Ray BorduinWebAssist

Dynamic dropdowns won't help.

You probably want something like:

<select onchange="this.form.submit();" name="product" id="product" width="160" style="width: 160px">
<option value="" selected>Search by Product</option>
<?php
do {
?>
<option value="<?php echo $row_prods['ID']?>" ><?php echo $row_prods['Name']?></option>
<?php
} while ($row_prods = mysql_fetch_assoc($prods));
$rows = mysql_num_rows($prods);
if($rows > 0) {
mysql_data_seek($prods, 0);
$row_prods = mysql_fetch_assoc($prods);
}
?>
</select>

Sign in to reply to this post

bjgarner241692

Thanks. That sets the Select properly.
I'm still struggling with this though. No matter which product I pick I get first product (alphabetically) on my landing page.

I want to pick the product and then pass the ID# as a URL Parameter.

Here is my full form code:

<form id="form1" name="form1" method="post" action="product.php?ID=<?php echo $row_prods['ID']; ?>">

</p>
<select onchange="this.form.submit();" name="product" id="product" width="160" style="width: 160px">
<option value="" selected>Search by Product</option>
<?php
do {
?>
<option value="<?php echo $row_prods['ID']?>" ><?php echo $row_prods['Name']?></option>
<?php
} while ($row_prods = mysql_fetch_assoc($prods));
$rows = mysql_num_rows($prods);
if($rows > 0) {
mysql_data_seek($prods, 0);
$row_prods = mysql_fetch_assoc($prods);
}
?>
</select>
</form>

Sign in to reply to this post

bjgarner241692

I got it: Javascript to the rescue.

<form id="form1" name="form1" method="post" action="product.php?ID=<?php echo $row_prods['ID']; ?>">

</p>
<select name="product" id="product" width="160" style="width: 160px"
OnChange="location.href=form1.product.options[selectedIndex].value">

<option value="" selected>Search by Product</option>
<?php
do {
?>
<option value="product.php?ID=<?php echo $row_prods['ID']?>" ><?php echo $row_prods['Name']?></option>
<?php
} while ($row_prods = mysql_fetch_assoc($prods));
$rows = mysql_num_rows($prods);
if($rows > 0) {
mysql_data_seek($prods, 0);
$row_prods = mysql_fetch_assoc($prods);
}
?>
</select>
</form>

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