Link to home
Start Free TrialLog in
Avatar of MHenry
MHenry

asked on

how to capture dynamic drop down list in PHP5, mySql?

I inherited an online store that I need some help with.

The store has a form that emails what products the customer has been looking at - a wish list. On the rendered page, there are product attributes that are pulled from the database. What I need to do is capture whichever attribute has been selected when the submit the form. I know how to do this if it's set, but when it's pulling it from the database I'm lost.

Is there a way to pull that info when I don't know in advance what is going to be showing on the page?

Here are two examples of attributes as rendered on the page:


<div class="wrapperAttribsOptions">
<h4 class="optionName back"><label class="attribsSelect" for="attrib-14">SPK Model</label></h4>

<div class="back">
<select name="id[14]" id="attrib-14">
  <option value="43">SPK-4</option>
  <option value="44">SPK-8</option>
</select>


------------------------------------------------

<div class="wrapperAttribsOptions">
<h4 class="optionName back"><label class="attribsSelect" for="attrib-1">Model</label></h4>
<div class="back">
<select name="id[1]" id="attrib-1">
  <option value="45">VC3-4C</option>
  <option value="1">VC3-4PG</option>
  <option value="3">VC3-4SG</option>
</select>


Best,
MH





SOLUTION
Avatar of kumaranmca
kumaranmca

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of MHenry
MHenry

ASKER

I just glanced at the links above and will look more later, but I don't think they will work.

The page has already been rendered. I don't need to do any database functions. I just need to collect the information from the field when the submit is done.

Basically, this is just like any other form where I'm gathering the user input. The problem is, the field changes.

I'm thinking I'm going to need to do something like:
$attribute= $_REQUEST['SOMETHING GOES HERE'];  where the Something would be similar to a LIKE in sql. So maybe the something would be -->  find element where IS LIKE "select name="id[*]"

I don't know how to do the something part.
Best,
MH