I want to add the items from a DROPDOWN LIST and a TEXTBOX into a cell in a table.

Can anybody help me out?

My current codes that insert the items from DROPDOWN LIST and a TEXTBOX into cell in table.

 <?php
            if(isset($_POST['btnAdd'])){
                if(!empty($_POST['emID']) & !empty($_POST['EName']) & !empty($_POST['OT_RATE']) & !empty($_POST['day_from']) & !empty($_POST['month_from']) & !empty($_POST['year_from']) & !empty($_POST['StartTime']) & !empty($_POST['EndTime']) & !empty($_POST['reason']))
                {
                   echo '<tr bgcolor="#FFFFD7" bordercolor="#FFFFD7">
                   <td><script language="text\javascript>document.HODApplyfrm.emID.options[document.HODApplyfrm.emID.selectedIndex].text</script></td>
                   <td><script language="text\javascript>document.HODApplyfrm.EName.value</script></td>
                   <td></td>
                   <td align="center"><input type="checkbox" name="delete[]"></input></td>
                   </tr>';
                   echo '</table>';
               }
           }

  ?>

Apart from this, I would like to add the selected items(dropdown list) and a texbox item to my database.

    from what i understand... ur form has been posted and now u want to display the posted values on the screen... wudnt some thing like this work and i think it wud be easier also?

    echo '<tr bgcolor="#FFFFD7" bordercolor="#FFFFD7">
    <td>'. $POST['emID'] . '</td>
    <td> . $
    POST['EName'] . '</td>
    <td></td>

    Apart from this, I would like to add the selected items(dropdown list) and a texbox item to my database.

    i cud not get u here ...cud u explain a bit? are u asking how to write these selected values to database? or u want to 'create' new fields in the database so that these values cud be written?

      WHen I use the codes that you've provide. It gives me the same value because......

      In the DROPDOWN LIST (emID) , I uses the Employeee Name as value and EMPLOYEE ID as the text.

      In the TEXTBOX (EName), the value is from the emID's value

      Therefore, when I uses $POST['emID'] , it gives me the Employee Name.
      When I uses $
      POST['EName'], it gives me the Employee Name also..

      How can I get the emID's text instead of it's value???

        ok now i understand a bit of ur prob.
        there are 2 ways u an do it...

        1. i assume u have the details in a database..so when u first display the select box... the 'value' and 'text' get populated from the database.... so in this case too u wud have to populate from the database.

        2. if u dont want to do this... then u cud use the same values for text and value. ie text=value in the select box.

        just out of curiosity... i wud normally use the ids as the value and name as the text.... this is easier coz the user gets to see the names of ppl(which is friendlier and easy to remember) and when the 'value's are submitted...my database works with the unique id. why are u doing just the opposite?

          Write a Reply...