Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Web Design (WordPress, Joomla, etc.) PHP Text input as checkbox

  • Abraham Chaffin

    January 4, 2011 at 6:20 pm

    Well – I guess that’s one reason why it’s better to pass an id with your key rather than a text description.

    Do you have a numeric product id you could pass and then tie it back to the description on the other side of the posting?

    If not you could do something like this:

    <?
    //SET YOUR ID TO ZERO BEFORE THE LOOP
    //USE THE ID TO MATCH PRODUCT INFORMATION AFTER POSTING
    $id++;
    ?>
    <?=$row_Recordset1['description']?>: <input type='text' size=2 value='' name="product_qnty_<?=$id?>" />
    <input type='hidden' name='product_desc_<?=$id?>' value="<?=$row_Recordset1['description']?>" />

    This isn’t really the best way at going at this but since I don’t know your entire setup it helps fix what you’re trying to do.

    Altered processing:

    <?
    //KEY FOR QUANTITY FIELDS
    $qnty_key=”product_qnty_”;

    //LOOP THROUGH THE POST FIELD
    foreach($_POST as $key => $val)
    {
    //IF THE BEGINNING OF THE POST FIELD IS THE QUANTITY KEY AND THE VALUE IS A NUMBER AND THE NUMBER IS OVER ZERO
    if(substr($key,0,strlen($qnty_key))==$qnty_key && is_numeric($val) && $val > 0)
    {
    $id=substr($key,strlen($qnty_key));
    $prod_description=$_POST[‘product_desc_’.$id];
    echo $prod_description.”: “.$val.””;
    }
    }
    ?>

    Abraham

  • Richard Williams

    January 4, 2011 at 7:16 pm

    thanks man

    Richard Williams
    p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o)

Page 2 of 2

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy