Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Problem with adding multiple records to a table

Quote Reply
Problem with adding multiple records to a table
Hi,

I am trying to add multiple rows to a table .. I have 2 questions regarding that.

1. Is it possible to have a customized template to add multiple rows just like the way we can have when adding a single row? if so where do I include it ..

2. If I specify the total number of rows to be added as 25 .. is it required that I add 25 rows or I can just add 10 and hit the submit button.

Thanks,

Dsouza
Quote Reply
Re: [sdsouza] Problem with adding multiple records to a table In reply to
You can add multi rows to a table by using:

db.cgi?do=add_multi_form&db=Sample&m=num_rows

1> The template is simply like:
Row 1: <input name="1-field1" value=""><input name="1-field2" value="">...
Row 2: <input name="2-field1" value=""><input name="2-field2" value="">...
....

<input type="hidden" value="add_record" name="do">
<input type="hidden" value="<%m%>" name="m">

2> You don't have to fill out all the rows on the form.

Hope that helps
TheStone.

B.
Quote Reply
Re: [TheStone] Problem with adding multiple records to a table In reply to
Hi,

I was wondering if I could add a customized template while adding multiple rows to the table. I mean customized in the sense when i add add one record.. I can have the form looke like the way I want it to look.. I can make any changes .. is it possible when adding multiple rows to the table.

For example: In the add_form.. it is like this

<table border="<%if m > 0 and m < 25%>0<%else%>1<%endif%>" cellpadding="0" cellspacing="0" width="65%">
<tr bgcolor="#FFFFFF" align="center" valign="center">
<td> <%if sdo%><!--generate a form for related database--> <%include custom_po_input1.html%>
<%else%> <%if m > 0 and m < 25%> <!--Add multipe rows--> <% Dbsql::HTML::generate_add_multi_form%>
<input name=m type=hidden value="<%m%>">
<%else%> <%include custom_inputs.html%> <%endif%> <%endif%> </td>

here I include the file "custom_inputs.html" to add one row.. so that it looks like the way I want it to be .. so I was wondering if its possible to do the same while addoing multiple rows.



2. Now If I give m as 25 .. It will give me a form to add 25 rows .. now what if I want to add only 10 rows.. I fill in the information for 10 rows ... and leave the other 15 blank .. how many rows will it add .. 25 or 10 .. Is it possible that I specify m as 25 and add only 10 rows .. is it possible to do that .

thanks,

Sandeep