PHP form processing - how to capture text from field that has variable Name/ID

Posted by user80151 on Stack Overflow See other posts from Stack Overflow or by user80151
Published on 2010-04-19T20:40:41Z Indexed on 2010/04/19 20:43 UTC
Read the original article Hit count: 238

Filed under:
|

I have a form that has a field pulled from the database as a dropdown. I need to get the text selected in the dropdown but I don't know in advance what the field ID will be.

This is basically just a form that has already been generated. I don't need to pull anything from the database, it's already on this page. All I need to do is get the form information and email it, no writing to the database.

I know how to do the _Request for the other fields based on the ID but I'm not sure how to do this one. The ID changes. It can be ID=1, ID-2, etc.

I need to do something like: _REQUEST form element where ID is LIKE "ID[*]" or something similar.

Any suggestions or links to tutorials?

Here are a couple samples of what the dropdown renders on the page:

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

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

TIA

© Stack Overflow or respective owner

Related posts about php

Related posts about forms