I'm not quite sure about your question, but I will say that I see some
problems with your code...

In the document.write(); function, I see 2 main problems...

one is that it doesn't look like you are closing your <tr><td>
tags...after the input tag you should add </td></tr>

The other is in the name="" attribute of the input tag...it looks like
you are escaping some but not all of your quotes, and not including a
closing paren for the .write function.  It should be like this:

document.write("<tr><td><input type=\"text\" name=\"c\" + i + \"\">");

or if that looks too confusing, use single quotes inside, like this:

document.write("<tr><td><input type='text' name='c' + i + ''>");

On Jul 21, 5:16 pm, Greg Evans <greg.djr...@gmail.com> wrote:
> The code now is like this:
>
> <div id="dialog" title="Create Manifest">
>                                          <form id="myForm" action="pl/
> newload.pl" method="post">
>                                          <table>
>                                                  <td>Chest:</td>
>                                                  <td><SELECT  
> NAME="Aircraft">
>                                                          <option>
>                                                                 <?php
>                                                                         
> $user="user";
>
> $password="pass";
>
> $database="completChest";
>
> mysql_connect('127.0.0.1',$user,$password);
>
> @mysql_select_db($database) or die( "Unable to select database");
>
> $query="SELECT * from Chests where chest_active=1";
>                                                                         
> $result =  
> mysql_query($query);
>                                                                         while 
>  
> ($myinfo= mysql_fetch_row($result)) {
>
> print "<option onselect( populate($myinfo[5]) ) value=\"$myinfo[0]\">".
> $myinfo[2]." ".$myinfo[3]." ".$myinfo[1];
>                                                                         }
>                                                                         ?>
>                                                         </select></td><tr>
>                                                         <tr><td  
> colspan="2">Items in Chest</td>
>                                                                  <script 
> type="text/
> javascript">
>                                                                 function  
> populate(max_chest){
>
> for(var i=0;i<=max_chest;i++){
>
> document.write("<tr><td><input type=\"text\" name=\"c"+i+"\">";
>                                                                         }
>                                                                 }
>                                                  </script>
>                                          </table>
>                                          </form>
>                                  </div>
>
> On Jul 21, 2009, at 1:41 PM, Glazz wrote:
>
>
>
> > Hi,
>
> > What is the code that you now? If you have none we can help you create
> > the code you need
>
> > But you are going to use $.ajax() to get the numbers that you are
> > talking about from the MySQL table.
>
> > And then you can update the form as your needs.
>
> > Btw, im a neewbie too but i can help in what i can :)
>
> > Regards,
> > Bruno.
>
> > On 21 Jul, 21:24, raisputin <greg.djr...@gmail.com> wrote:
> >> Hello, newb here ;)
>
> >> This is probably the wrong place to ask, but maybe someone could  
> >> point
> >> me in the right direction if that is the case :)
>
> >> I am pulling data from a mysql database to partially populate a form.
> >> This is all done in a 'dialog' which is really slick, so when I open
> >> that dialog, i get (please excuse the crude drawings)
>
> >> Dropdown menu
> >> [ Chest 1 ]
> >> [ Chest 2 ]
> >> [ etc...     ]
>
> >> That part I have working fine, what I need to do now is make it so
> >> that when someone selects Chest_N it will populate the form with say
> >> the number of drawers in that chest as each chest may have any number
> >> of drawers (within reason of course). The information for each chest,
> >> such as mfr, etc. and including the number of drawers is stored in  
> >> the
> >> 'chests' table in mysql like
>
> >> Table: Chests
> >> chest_id
> >> chest_name
> >> chest_color
> >> chest_serial
> >> chest_num_drawers
>
> >> so when I select a chest in the dropdown, I need to create fields  
> >> like
> >> "Drawer 1 - Drawer N" as text boxes in the form. The mySQL queries I
> >> can do as that is super simple, I am just not sure how to make it do
> >> the query once a chest is selected.
>
> >> Any help appreciated, and if I am asking in the wrong place, a
> >> direction to the proper place to ask would also be appreciated. :)
>
> >> Thanks in advance

Reply via email to