how can i add value of textbox in listbox in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amthree
Forum Newbie
Posts: 1
Joined: Tue Apr 24, 2007 8:37 am

how can i add value of textbox in listbox in php

Post by amthree »

Hi,

how can i add value of textbox in listbox in php. I have a textfield and want to type information in the textbox and after enter or submit add the value in a listbox, clear the textbox, and again type information in the textbox and add the value again in de listbox and so on in a loop for about 10/24 times. So the listbox is growing with all the values I entered in the textbox. And if it can all in the same php-page.

I am a novice to php so maybe someone can help me with a php-script that can do this.


Thanx in advance,


Amthree
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You will either be using sessions or dynamically generating hidden input tags with the value information to update the list box.

If you want more help, please ask specific questions. It helps us if you post your code too.
Mohit_Prog
Forum Commoner
Posts: 26
Joined: Mon Apr 23, 2007 6:10 am

Post by Mohit_Prog »

in the lostfocus event of a textbox, fire the submit action of the form. submit the form to itself( i mean same page) .
now fetch the request from a textbox parameter and store in some variable say $test.

your listbox should be filled such a way that if $test contains something then assign it to a listbox.

try this. if still not clear then ask some specific question from this reply.
Post Reply