473,884 Members | 2,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to automatically insert data to mysql database without submit button in php?

17 New Member

I need help...
How to automatically insert data to mysql database without submit button using php?
Is there a way on this?

thanks a lot.
Dec 1 '09 #1
17 17561
6,050 Recognized Expert Expert
You'll have to be more specific. Can you present an example scenario?
Dec 1 '09 #2
8,658 Recognized Expert Moderator Expert
to answer the question verbatim (though that probably won’t help), the PHP script does not care, how the data are delivered, as long as they are delivered (somehow). although I guess if it is about user input, a form (with submit button) is definitely the easiest and most straightforward approach.
Dec 1 '09 #3
9,735 Recognized Expert Moderator Expert
Hi Msmjsuarez,

When should your data be inserted into the database?

It probably shouldn't happen when the user is in the middle of providing updated data...so how can you tell when the data should be inserted?

An easiest approach is to use a submit button, but you could always use JavaScript to determine if the user is finished editing. Once the user's finished you could use Ajax to submit the information to the server.

The hard part is going to be determining when the user is finished....whe n it is appropriate to submit the information.

Also, sometimes users have JavaScript and Ajax disabled so this may cause a problem with your web page. Use the <noscript> tags if you really want to take this approach.

Dec 1 '09 #4
17 New Member
hi everyone.

I have one textbox only in a page and the value of the textbox will obtain through the swipe of the barcode.
The scenario here is that i want to automatically insert the barcode into the mysql database after it is being swiped by the user. More specifically, they will not hit enter anymore after swipe their barcode, it will just automatically inserted to the database.
How to do this?

Thanks advance guys.
Dec 2 '09 #5
1,584 Recognized Expert Top Contributor
Ok, still you have to know when they're done entering the number. The bar code scanner works just like a keyboard, it just types for you.

So let's say you type in a bunch of numbers, when should you know it's done typing?

If the length of the bar code digits are fixed (e.g. 10 digit number), then the following may be a solution:

Having a javascript look inside the text box every time something is entered (the value is changed), and if it is 10 characters long, validate it, and send it off using AJAX, and then clear the textbox to be ready for the next entry.

If you have variable length product codes, then maybe a time solution. Every 2 seconds the box is checked for a value and is sent off if it's different than the last sent value.

You should have a manual mode, where if the bar code is damaged, the operator can hand type the product code into it and press enter.

Good luck,

Dec 2 '09 #6
17 New Member
hi dlite922.

do you have any codes for this?

thanks advance.
Dec 2 '09 #7
23 New Member
hi msmjsuarez -
how are you planning on doing this? Is it going to be based on a fixed length of the barcode number, or a timed interval?

are you going to use javascript?
It seems like you're going to have to use javascript here.
Maybe try coding something and post it here?

Dec 2 '09 #8
17 New Member
Expand|Select|Wrap|Line Numbers
  1. <html> 
  2.   <head> 
  3.   <title>HOW TO: Beep when text field full Using Javascript</title> 
  4.   <meta name="author" content="Shannon Norrell"> 
  5.   <script language="javascript"> 
  6.     function DoCheckLength(aTextBox) { 
  7.       if (aTextBox.maxLength - aTextBox.value.length==0) { 
  8.         document.theForm.submit(); 
  9.         //beep.play(); 
  10.       } 
  11.     } 
  12.   </script> 
  13. </head> 
  14. <body> 
  15.   <FORM NAME="theForm" action=index.php> 
  16.     <input type="text" maxlength="12" size="12" 
  17. onkeyup="DoCheckLength(this);" ID="firstTextBox" name="firstTextBox"> 
  18.     <input type="hidden" maxlength="5" size="5" 
  19. onkeyup="DoCheckLength(this);" ID="secondTextBox" NAME="secondTextBox"> 
  20.   </FORM> 
  21.   <EMBED id="beep" SRC="beep.wav" NAME="beep" AUTOSTART="FALSE" 
  23. </body> 
  24. </html>
Dec 2 '09 #9
17 New Member
That's a great solution...just try to develop.
Dec 2 '09 #10

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

Similar topics

by: Nomen Nescio | last post by:
can anyone be so kind as to look at http://www.mysolution.ws/HYPOCRITE.php and let me know why it isn't passing the form data to http://www.mysolution.ws/insertHYPOCRITES.php for the most part, the scripts were created with http://phpcodegenie.sourceforge.net/
by: Luis | last post by:
Application X has three screens. The user captures information on screen one and then clicks a navigation button to go onto screen two. He does the same on screen three. At the bottom of screen three is a submit button. When this button is clicked the system does some calculations with the information that is supplied and then uploads all the info that was captured on the screens to the database. My question is: Should the data be...
by: Brian Conway | last post by:
Can anyone give me a quick little break down of what I would need to do to insert information into a database onClick of and Submit button? I am new to all of this and have done it with datagrids, but want to do it with just textboxes filled in and on click of the Submit button that it would take those boxes and insert a record into the database. This is for C#. below is a little of what I have on the submit button but I don't think it...
by: Stephen V | last post by:
Can anyone help me out with this problem. I would like to redirect/ go to another php page when my SQL insertion is done and also send a variable at the same time. the idea is, to come on my page for the first time and not doing anything, then I fill up my form and insert the data (with the button "add request" and when the oci_execute is done go to another page. all I need to know is how to go to another page automatically... and...
by: MrHelpMe | last post by:
Hello experts, O.k I give up on this. I have an LDAP query from asp working correctly. It is returning data fine. Now I need to know how to take this data and then submitt it into the database. Can this be done in one page and is there any other way to do this without putting a submit button on a page. Almost like a file that I can pass to the user and he can click it to insert into a database. My way of do it is to simply to put...
by: andrewtayloruk | last post by:
I'm a newbie when it come to things php and i'm having a bit of trouble. I'm trying to insert data from an html form into a mysql database and can't get it to work. Just a few bits about my setup, i'm running an sql server locally, i've created the database, table and fields. I think what i'm missing is something that actually runs the sql query when i hit the submit button. Also, i'm aware i haven't made the data being inserted safe, i...
by: andrewtayloruk | last post by:
Hi i was wondering if anyone could help.... I have made a little script that puts whatever a user enters into a mysql database. As well as the forms my script has an image input that uploads an image to my webserver. The thing i'm stuck on is getting the script to input the name of the file into a field in the database. So basically the file will be uploaded and when the submit button is clicked a link to that image will be generated and put...
by: adamace5o | last post by:
When i try to use post variables with php and mysql i can't get the insert into statement to accept varibles as values. If i use 'test' instead of $test it does work. I suspect it is something to do with the javascript im using but i can print the correct values so why am i unable to use them to enter data to a database? sorry i am new to all this here is the updatedata.php file <?php session_start(); $host="localhost"; // Host...
by: brianrpsgt1 | last post by:
I am attempting to insert data from a HTML form using a .psp script. I can not find how to link the data that is inserted into the form to the variables in the .psp script to then insert into the MySQL Insert statement. I am familiar with PHP, where you would write $_POST(), however I can not find the equivalent in PSP. I believe that this is the my missing piece. Technically, what is occurring that that when I click the 'Submit'...
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
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 we have to send another system
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.