1. Hey Guest Did you know you can win an Honor 10 phone worth ₹33,000 and an additional ₹70,000 in paytm vouchers, just by replying to some threads and taking part in the discussions happening in the Honor Hub?

    What are you waiting for? Start commenting and start winning! Remember to read the instructions posted here.

    Dismiss Notice

a variable number of inputs using JAVASCRIPT for PHP to insert MYSQL

Discussion in 'Programming' started by bukaida, Jun 25, 2009.

Thread Status:
Not open for further replies.
  1. bukaida

    bukaida New Member

    Joined:
    Jul 21, 2005
    Messages:
    326
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    KOLKATA
    First let me start out by saying I am a beginner so I apologize in
    advance if what I ask is too fundamental.

    I am accessing a MYSQL database through a web browser and I am
    entering data into data tables using PHP.

    The problem I am facing is that the number of input rows on the web
    page is not fixed and will vary each time. Someone suggested I use
    Javascript and that is why I am here now.


    Here is an example of the rows that I would like to be able to fill :
    Say for
    record 1(Persons living in canada)
    ---------------------------------
    id name address
    ---------------------------------
    1 john canada
    2 Jim canada
    3 smith canada
    -------------------------------

    record 2(Persons living in LA)
    ----------------------------------
    id name address
    ---------------------------------
    1 joe LA
    2 mathew LA
    -------------------------------

    I have to design an insert form with textbox which will allow me to insert variable number of records in the table(probably giving an option at the begining,to specify how many records). I am using php 4.4 and mysql 5.1. Please help.
     
  2. adatapost

    adatapost New Member

    Joined:
    Jul 5, 2009
    Messages:
    14
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    India/Gujarat/Mehsana
    create a form for each record.
     
  3. OP
    OP
    bukaida

    bukaida New Member

    Joined:
    Jul 21, 2005
    Messages:
    326
    Likes Received:
    1
    Trophy Points:
    0
    Location:
    KOLKATA
    How will you know in advance about your data?
     
  4. Power_user_EX

    Power_user_EX Searching for Anti-Matter

    Joined:
    Aug 24, 2008
    Messages:
    203
    Likes Received:
    3
    Trophy Points:
    0
    Location:
    Mumbai
    plz explain ur problem a bit more.
     
  5. asingh

    asingh New Member

    Joined:
    May 28, 2008
    Messages:
    5,317
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    New Delhi
    Is it a data entry form..or a display form..?? That has to have dynamic rows..??
     
  6. lucifer_is_back

    lucifer_is_back New Member

    Joined:
    Oct 17, 2008
    Messages:
    124
    Likes Received:
    0
    Trophy Points:
    0
    just make fix the max number of columns in tables for address
    Eg
    id
    Name
    Age
    Add1
    Add2(Nullable)
    Add3(Nullable)
    Add4(Nullable)

    if a person has more than a single line u can fill it up
     
  7. ramprasad

    ramprasad New Member

    Joined:
    May 7, 2004
    Messages:
    375
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    00-1D-7D-5A-34-2E
    Have a drop down box at the beginning of the page to capture the number of records u want to add.
    On the 'OnSelect' or similar function of that Drop down box, associate a JS which will put the 'Input details' (like Name, Country,etc.) required number of times.
     
Thread Status:
Not open for further replies.

Share This Page