473,322 Members | 1,614 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

auto generated field in php and stored into database

I need you help please....

first I want to create a page for php.. Inside it, I can add a number in a textfield... Then, textfield for 'name' will be generated based on that number...

for example, i enter number =3; then 3 textfield will generated to fill the name.. and all the 3 name will stored into a table in database called 'names'

here is simple code :

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function varifyInput()
  5. {
  6.         var bb = document.getElementById('aa').value;
  7.         var i = 0;
  8.         var html = ''; 
  9.  
  10.         for (i=1;i<=bb;i++) {
  11.         document.getElementById('aaa').innerHTML += "Name : <input type='text' value='' /><br />";
  12. }}
  13. </script>
  14.  
  15. </head>
  16. <body>
  17. <form id="form1" name="form1" method="post" action="">
  18.  <label>
  19.   Number 
  20.   <input type="text" name="aa" id="aa" />
  21.   </label>
  22. <input type="submit" name="submit" id="submit" onClick="varifyInput()" value="Submit"     />
  23.  <div id="aaa">
  24.  
  25.   </div>
  26. </form>
  27. </body>
  28. </html>
May 28 '13 #1
1 4517
Oralloy
985 Expert 512MB
azai lestary,

You have the basic idea down; from here, the simplest thing to do is have a separate PHP page to process the result, when the "submit" button is pressed. The one thing you didn't do was to assign names the inputs that you generate.

In the processing page, you have the count of inputs available - "aa" - and from that you can loop around all of the "Name" input fields. For your first pass, I suggest that you simply display the values recieved.

Once you know that you are recieving data correctly, then you can create your database interface, and insert the records.

Hopefully this lets you make progress.

Cheers,
Oralloy
May 28 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Steve Barker | last post by:
Hi guys! In Visual Studio .NET, I like to enable auto-generation of XML documentation on the project properties screen, by adding an XML file name under "Configuration Properties" --> "Build"...
3
by: Poul Møller Hansen | last post by:
Hi, I need an auto incrementing field that will contain values like N000001, N000002, N000003 etc. I think the way is to use the value from an identity field in a stored procedure that is...
0
by: Viorel | last post by:
Working as a beginner with data objects in Visual Studio 2003 and C#, I use the "Generate Dataset" command in order to generate automatically the dataset objects based on data adapters. Generated...
4
by: MUSTAFA IRSHAD | last post by:
DEAR SIRS, I AM DEVELOPING A SOFTWARE BY USING VB.NET AND SQLSERVER 2000 FOR A NETWORK ENVIRONMENT. I HAVE A BROBLEM THAT I HAVE A FIELD FOR PRIMERY KEY WHICH IS AUTO GENERATED. I NEED THAT WHEN...
9
by: danielbuus | last post by:
Hey there :) I'm using Ruby on Rails to create a migration of a legacy database on an MS SQL Server. I'd like to name my constraints myself, such as 'pk_authors', but in the cases where a table...
0
by: Michele 'xjp' | last post by:
Hi, I need a data structure (better if in STL) what give me: - an auto generated auto-increment integer field ('id') - various string fields This structure data must be searchable: I must be...
2
by: pratitripathi | last post by:
Hi , I'm having problem in generating auto generated Code whose format is 'PRM-0000' .And it should be incremented by one everytime when new Id is generated.the value will be stored in database. ...
0
chumlyumly
by: chumlyumly | last post by:
Hello scripters - OS: Mac OSX Language: PHP w/ MySQL database I've created an insert page where a user inputs his info, which then goes to four different tables in a MySQL database. The...
3
by: =?Utf-8?B?Um9nZXIgVHJhbmNoZXo=?= | last post by:
The problem I'm coming across now is that I can't update such a column, because I have set the auto generated value to true, and LINQ won't let me change such a value, a la...
2
by: Bobby Edward | last post by:
I am using VS 2008 SP1, ASP.NET 3.5, VB.NET, MySQL (latest version). I created a new dataset using VS. In the ds I have a users table. I let it create the "Fill, GetData" functions in the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.