[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Textbox to update another textbox by reading a table

Posted on 2011-10-05
6
Medium Priority
?
182 Views
Last Modified: 2012-05-12
Hi,

I have a table (say "testtable") as below which I read into PHP:

ID............Description
1.............orange
2.............red
3.............blue

I have a form called "testform". On this are two text boxes, one called "textbox" and the other called "textanswer".

I'm trying to type a number into "textbox", get it to look up this number on the ID field of the table mentioned above and put the corresponding colour into "textanswer".

Usually I would do this by having "textbox" set up as a dropdown field and pull the second column into "textanswer" when changed. However, in this case I can't do this because if a colour is not found on the table, the user needs to be able to type in their own value in "textbox". Also, there will be some 15000 records in the table.

Can someone please show me how to set this up, if possible?

Many thanks in advance
0
Comment
Question by:kbit
  • 3
5 Comments
 
LVL 8

Expert Comment

by:PranjalShah
ID: 36919307
You can still do this by having the dropdown, you need an extra value at the end as "OTHER" and if a user selects that, one blank textbox appears and then you can process the form.

0
 

Expert Comment

by:niazz2004
ID: 36919738
find in google easy
0
 

Accepted Solution

by:
kbit earned 0 total points
ID: 36923187
I;m thinking a lazier way would be to let the user type their value in "textbox", make them press save and then PHP would do all the checking and reload the same page with or without the relevant "textanswer".

Another way would be to submit the form with the onchange of "textbox", again PHP would do the work.
0
 

Author Comment

by:kbit
ID: 36947228
Anyone in the Javascript zone have any ideas? There has to be a way of doing this without submitting through PHP!
0
 

Author Closing Comment

by:kbit
ID: 37277662
No other method was found, this one is working fine
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses
Course of the Month18 days, 21 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question