473,471 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how can i store information in mysql database ?

10 New Member
i create table :-
Expand|Select|Wrap|Line Numbers
  1. create table jos_callback
  2. (
  3. Id varchar(20) not null,
  4. first_name varchar(20),
  5. last_name varchar(20) null,
  6. email_id varchar(20),
  7. radiobutton varchar(20), 
  8. selectoption varchar(20), 
  9. phone varchar(20),
  10. mobile varchar(20),
  11. select_time varchar(20),
  12. country varchar(20),
  13. state varchar(20),
  14. city varchar(20),
  15. primary key(Id)
  16. )ENGINE = MyISAM ;
  17.  
  18. create form:-
  19. {source}
  20. <script type="text/javascript">
  21.      function validate(frm)
  22.     {
  23.         var x=document.forms["form2"]["fname1"].value;
  24. if (x==null || x=="")
  25.     {
  26.     alert("First name must be filled out");
  27.     return false;
  28.     }
  29.     var y=document.forms["form2"]["lname1"].value;
  30. if (y==null || y=="")
  31.     {
  32.     alert("last name must be filled out");
  33.     return false;
  34.     }
  35.  
  36.         var w=document.forms["form2"]["std1"].value;
  37.         if(w == "")
  38.     {
  39.         alert("Please Enter Std-Code.");
  40.         return false;
  41.     }
  42.     if(isNaN(w))
  43.     {
  44.         alert("Please Enter Valid Std-Code.");
  45.         return false;
  46.     }
  47.     if(w.length < 3)
  48.     {
  49.         alert("Std-Code should be minimum 3 digits");
  50.         return false;
  51.     }
  52.  
  53.      var p=document.forms["form2"]["phone1"].value;
  54.     if(p == "")
  55.     {
  56.         alert("Please Enter Phone Number.");
  57.         return false;
  58.     }
  59.     if(isNaN(p))
  60.     {
  61.         alert("Please Enter Valid Phone Number.");
  62.          return false;
  63.     }
  64.     if(p.length < 7)
  65.     {
  66.         alert("Contact Number should of minimum 7 digits");
  67.         return false;
  68.     }
  69.  
  70.      var b=document.forms["form2"]["mobile1"].value;
  71.     if(b == "")
  72.     {
  73.         alert("Please Enter Mobile Number.");
  74.         return false;
  75.     }
  76.     if(b!=""){
  77.         if(isNaN(b))
  78.         {
  79.             alert("Please Enter Valid Mobile Number.");
  80.             document.form1.b.value='';
  81.              return false;
  82.         }
  83.         if(b.length < 10)
  84.         {
  85.             alert("Mobile Number should be minimum 10 digits");
  86.             return false;
  87.         }
  88.     }
  89.  
  90.     }
  91.  
  92.     function add_feed()
  93.     {
  94.         validate(frm);    
  95.         var div1 = document.createElement('div');
  96.         div1.innerHTML = document.getElementById('newlinktpl').innerHTML;
  97.         document.getElementById('newlink').appendChild(div1);
  98.  
  99.     }
  100.     </script>
  101. <?php
  102.     if(isset($_POST['submit1']))
  103.  
  104.     {
  105.  
  106.     $sql="INSERT INTO `jos_callbackentry` (`fname1`, `lname1`, `std1`, `phone1`, `mobile1`) VALUES ( '$_POST[fname1][i]', '$_POST[lname1][i]', '$_POST[std1][i]', '$_POST[phone1][i]', '$_POST[mobile1][i]')";
  107. mysql_query($sql);
  108.  
  109.     }
  110. ?>
  111. <!--here we insert html code -->
  112. <form method="post" action="" name="form2" id="form2" onsubmit="return validate(this)">
  113.     <table>
  114.     <tr>
  115.      <td valign=top>Submit Callback Entry</td>
  116.      <td valign=top><div id="newlink">
  117.          <div class="feed">
  118.             <!-- <input type="text" name="feedurl[]" value="http://feeds.feedburner.com/satya-weblog/scripting" size="50"> <br > -->
  119.             <table width="100%" border="0"align="center" cellpadding="0" cellspacing="0" class="offwhite">
  120.              <tr>
  121.                 <td><table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="white">
  122.                     <tr class="sidemenuebg">
  123.                      <td width="5%" align="right" nowrap class="simplegraytable"></td>
  124.                      <td width="12%" align="right" nowrap><font color="#FF0000">*</font>First Name</td>
  125.                      <td width="39%"><input name="fname1[]" id="fname1" type="text" size="25" maxlength="100" ></td>
  126.                      <td width="20%" align="right"><font color="#FF0000">*</font> Last Name</td>
  127.                      <td width="31%"><input name="lname1[]" id="lname1" type="text" size="25" maxlength="100" ></td>
  128.                     </tr>
  129.                     <tr class="simplegraytable">
  130.                      <td colspan="2" align="right" nowrap>Phone</td>
  131.                      <td align="left"><input name="std1[]" id="std1"type="text" size="5" maxlength="5" >
  132.                         <input name="phone1[]" id="phone1" type="text" size="20" maxlength="10" >
  133.                         <br >
  134.                         <span class="style5">STD Code - Number</span></td>
  135.                      <td align="right"><font color="#FF0000">*</font>Mobile</td>
  136.                      <td align="left"><input name="mobile1[]" id="mobile1" type="text" size="25" maxlength="10" ></td>
  137.                     </tr>
  138.                  </table></td>
  139.              </tr>
  140.             </table>
  141.          </div>
  142.         </div></td>
  143.     </tr>
  144.     </table>
  145.     <p> <br>
  146.     <input type="submit" name="submit1" value="submit">
  147.     <input type="reset" name="reset1">
  148.     </p>
  149.     <p id="addnew"> <a href="javascript:add_feed()">Add New </a> </p>
  150. </form>
  151. <!-- Template. This whole data will be added directly to working form above -->
  152. <div id="newlinktpl" style="display:none">
  153.     <div class="feed">
  154.     <table width="100%" border="0"align="center" cellpadding="0" cellspacing="0" class="offwhite">
  155.      <tr>
  156.         <td><table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" class="white">
  157.             <tr class="sidemenuebg">
  158.              <td width="5%" align="right" nowrap class="simplegraytable"></td>
  159.              <td width="12%" align="right" nowrap><font color="#FF0000">*</font>First Name</td>
  160.              <td width="39%"><input name="fname1[]" id="fname1" type="text" size="25" maxlength="100" ></td>
  161.              <td width="13%" align="right"><font color="#FF0000">*</font>Last Name</td>
  162.              <td width="31%"><input name="lname1[]" id="lname1" type="text" size="25" maxlength="100" ></td>
  163.             </tr>
  164.             <tr class="simplegraytable">
  165.              <td colspan="2" align="right" nowrap>Phone</td>
  166.              <td align="left"><input name="std1[]" id="std1"type="text" size="5" maxlength="5" >
  167.                 <input name="phone1[]" id="phone1" type="text" size="20" maxlength="10" >
  168.                 <br >
  169.                 <span class="style5">STD Code - Number</span></td>
  170.              <td align="right"><font color="#FF0000">*</font>Mobile</td>
  171.              <td align="left"><input name="mobile1[]" id="mobile1" type="text" size="25" maxlength="10" ></td>
  172.             </tr>
  173.          </table></td>
  174.      </tr>
  175.     </table>
  176.     </div>
  177. </div>
  178. {/source} 
when i store information there is problem only array store in db.
but when i click on add new filed then information is store in different row but this is not happen info store only in one row as array.
how can i store different filed value in db .
Dec 24 '11 #1
1 2028
Rabbit
12,516 Recognized Expert Moderator MVP
I have no idea what you just said.
Dec 25 '11 #2

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

Similar topics

2
by: mos | last post by:
I want to put a MySQL 4.1 database on a Win2k laptop but the problem is it contains confidential client information. It has to be Window because applications accessing the database are written in...
1
by: mm | last post by:
I have several korn shell scripts I use with a MySQL database on the same server (Solaris). I am moving to a Linux environment where the MySQL database is on another server. I would like to...
5
by: lawrence k | last post by:
I'm a little weak on my basic I/O. Help me out please. Is it right to say that I can just open any file with file(), get it as a string, and then store in a MySql database, in, say, a MediumText...
7
by: mukeshpatil | last post by:
How to get data from .CSV file using php & store it into Mysql database I want to read data from two different .CSV files using php & How to store it into Mysql Database tables Please help me...
12
by: mistral | last post by:
phpMyAdmin 2.6.2 problem: can no connects to mySQL database: each time shown error #1045 - Access denied for user 'username'@'192.168.1.2' (using password: YES) Is seems, this is most common...
4
by: grouchy | last post by:
hello all, not sure if i fully explained myself on an earlier post. All i really need to do is to store an xml file into mysql database. I have no idea how to do this, including any php code i...
2
by: sookfuny1984 | last post by:
I am facing a problem on how to parse (analyze) apache log file (access or error file) so that the data in log file will be imported to MYSQL database?? anyone can help?
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
2
by: secutos | last post by:
I have the option of storing data online as text files, or storing data online in a MySQL database. If the information is stored as a text file, all I have to do is a HttpWebRequest to the text file...
1
by: dparent | last post by:
I have a MySQL database and would like to upload multiple pdf files at once and store the information into the db. Here is the db I created: 1. CREATE TABLE `file` ( 2. `id` Int...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.