dynamically created tables on the basis of user inputs in the textbox

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • malika
    New Member
    • Apr 2013
    • 7

    dynamically created tables on the basis of user inputs in the textbox

    How to create dynamically tables on the basis of user inputs in the textbox for example if user write 3 in the textbox three table should be display n so on
    code of table is
    this is my table code
    Code:
    <table border="1" align="center">
    <tr><th>A</th><th>W</th><th>NO</th><th>AV</th><th>AP</th><th>AP Phase</th><th> Consumption </th></tr>
    <tr><td>Tl</td>
    <td>
    <select  id="in4"  name="t1" onclick="getText3()" onchange="getText39()" onchange="getText89()" >
     <option value="0"> 0 </option>
      <option value="12"> 12 </option>
      <option value="18"> 18 </option>
      <option value="24"> 24 </option>
      <option value="75"> 75 </option> 
      </td>
      </select>
    <td><input type="text" name="t2" id="in1" onclick="getText3()" onchange="getText39()" onmouseout="getText89()"> </td>
    <td>
    <select name="a1" id="in2" onclick="getText3()" onchange="getText39()">
     <option value="0"> 0 </option>
      <option value="1"> 1 </option>
      <option value="2"> 2 </option>
      <option value="3"> 3 </option>
      <option value="4"> 4</option> 
        <option value="5"> 5</option>   
    
      </td>
      </select>
      <td><input type="text" id="in3" name="username" Readonly/></td>
      <td><input type="text" id="in39" Readonly/></td>
    <td><input type="text" id="in89" name="table" readonly="in89" /></td>
     </tr>
    <tr><td>FA</td>
    <td><input type="text" name="t11" id="in44" value="100"/></td>
    <td><input type="text" name="t22" id="in11"  onclick="getText4()" onchange="getText37()"  onmouseout="getText98()"  /> </td>
    <td>
    <select name="a11" id="in22"  onclick="getText4()" onchange="getText37()" >
     <option value="0"> 0 </option>
      <option value="1"> 1 </option>
      <option value="2"> 2 </option>
      <option value="3"> 3 </option>
      <option value="4"> 4</option> 
        <option value="5"> 5</option>   
    
      </td>
      </select>
      <td><input type="text" id="in33" name="name" Readonly/></td>
        <td><input type="text" id="in37" Readonly/></td>
          <td><input type="text" id="in98" /></td>
     </tr>
     <tr><td>Bu</td>
    <td><select  id="in444"  name="tr" onclick="getText5()" onchange="getText399()" onchange="getText899()" >
     <option value="0"> 0 </option>
      <option value="40"> 40 </option>
      <option value="60"> 60 </option>
      <option value="80"> 80</option>
      <option value="100"> 100</option> 
      </td>
      </select>
    <td><input type="text" name="trr" id="in111"  onclick="getText5()" onchange="getText399()" onmouseout="getText899()"/> </td>
    <td>
    <select name="arr" id="in222"  onclick="getText5()" onchange="getText399()"/>
    <option value="0"> 0 </option>
      <option value="1"> 1 </option>
      <option value="2"> 2 </option>
      <option value="3"> 3 </option>
      <option value="4"> 4</option> 
        <option value="5"> 5</option>   
    
      </td>
      </select>
      <td><input type="text" id="in333" name="class" Readonly/></td>
        <td><input type="text" id="in399" Readonly/></td>
         <td><input type="text" id="in899" name="table1" readonly="in899" /></td>
     </tr> </table>
    Tc<input type="text" name="t6" id="in123" onclick="getText6()"/></td>
     Tcr<input type="text" name="abc" id="in134"  onclick="getText66()"/></tr>
     </form>
    Last edited by Rabbit; May 24 '13, 03:39 PM. Reason: Please use code tags when posting code.
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    Please use code tags when posting code.

    When the user selected value is sent to the php page, use a loop to echo the table that you have there 3 times.

    Comment

    • malika
      New Member
      • Apr 2013
      • 7

      #3
      how could i apply loop on the table ? can u help in this regard as i am new in ths php plz help me where i put the loop

      Comment

      • Rabbit
        Recognized Expert MVP
        • Jan 2007
        • 12517

        #4
        You put the loop around the table creation code.

        Since you're new to PHP, it may help you to invest some time in a tutorial. This one is a good one to start with: http://www.w3schools.com/php/

        Comment

        Working...