[PHP] populate form input option dropdown box from existing data

2009-06-15 Thread PJ
I am having difficulties figuring out how enter retrieved data into a dropdown box for editing. Here's a snippet: ...snip Civilization Monuments, Temples & Tombs Pharaohs and Queens... snip As I understand it, I need to put an array ( $categoriesIN[] ) somewhere in the abo

RE: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread Dajve Green
> -Original Message- > From: PJ [mailto:af.gour...@videotron.ca] > Sent: 15 June 2009 23:10 > To: php-general@lists.php.net > Subject: [PHP] populate form input option dropdown box from existing data > > I am having difficulties figuring out how enter retrieved data

Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread kranthi
the above post points to a 404 page any ways as suggested above in_array() will do the trick for you. i prefer using a template engine like smarty.. http://www.smarty.net/manual/en/language.function.html.options.php One line of code and you are done -- PHP General Mailing List (http://www.p

RE: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread jenai tomaka
own box from existing data > > > > -Original Message- > > From: PJ [mailto:af.gour...@videotron.ca] > > Sent: 15 June 2009 23:10 > > To: php-general@lists.php.net > > Subject: [PHP] populate form input option dropdown box from existing data > > > &g

Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread tedd
At 6:09 PM -0400 6/15/09, PJ wrote: I am having difficulties figuring out how enter retrieved data into a dropdown box for editing. Here's a snippet: ...snip Civilization Monuments, Temples & Tombs Pharaohs and Queens... snip As I understand it, I need to put an array (

RE: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread Dajve Green
t: 16 June 2009 15:56 > To: m...@dajve.co.uk; af.gour...@videotron.ca; php-general@lists.php.net > Subject: RE: [PHP] populate form input option dropdown box from existing > data > > > You can try like this, > > $row = stored data; > > and write the options li

RE: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread Dajve Green
A *multiple* select control, as in Phil's initial request will return an array, however. > -Original Message- > From: tedd [mailto:tedd.sperl...@gmail.com] > Sent: 16 June 2009 15:58 > To: PJ; php-general@lists.php.net > Subject: Re: [PHP] populate form input opti

Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread PJ
jenai tomaka wrote: > You can try like this, > > $row = stored data; > > and write the options like this > > > > Yuri Yarlei. > > Yuri, I'm still "wet behind the ears" on this so I don

Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread Ashley Sheridan
On Tue, 2009-06-16 at 15:48 -0400, PJ wrote: > jenai tomaka wrote: > > You can try like this, > > > > $row = stored data; > > > > and write the options like this > > > > > > > > Yuri Yarlei. > > > >

Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread PJ
Ashley Sheridan wrote: > On Tue, 2009-06-16 at 15:48 -0400, PJ wrote: > >> jenai tomaka wrote: >> >>> You can try like this, >>> >>> $row = stored data; >>> >>> and write the options like this >>> >>> >>> >>> Yuri Yarlei. >>> >>>

Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread Ashley Sheridan
On Tue, 2009-06-16 at 18:19 -0400, PJ wrote: > Ashley Sheridan wrote: > > On Tue, 2009-06-16 at 15:48 -0400, PJ wrote: > > > >> jenai tomaka wrote: > >> > >>> You can try like this, > >>> > >>> $row = stored data; > >>> > >>> and write the options like this > >>> > >>> > >>> > >>> Yu

Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread PJ
Ashley Sheridan wrote: > On Tue, 2009-06-16 at 18:19 -0400, PJ wrote: > >> Ashley Sheridan wrote: >> >>> On Tue, 2009-06-16 at 15:48 -0400, PJ wrote: >>> >>> jenai tomaka wrote: > You can try like this, > > $row = stored data; > >

Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread PJ
Ashley Sheridan wrote: > On Tue, 2009-06-16 at 18:19 -0400, PJ wrote: > >> Ashley Sheridan wrote: >> >>> On Tue, 2009-06-16 at 15:48 -0400, PJ wrote: >>> >>> jenai tomaka wrote: > You can try like this, > > $row = stored data; > >

Re: [PHP] populate form input option dropdown box from existing data

2009-06-16 Thread Ashley Sheridan
On Tue, 2009-06-16 at 20:46 -0400, PJ wrote: > Ashley Sheridan wrote: > > On Tue, 2009-06-16 at 18:19 -0400, PJ wrote: > > > >> Ashley Sheridan wrote: > >> > >>> On Tue, 2009-06-16 at 15:48 -0400, PJ wrote: > >>> > >>> > jenai tomaka wrote: > > > >

RE: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread Ford, Mike
On 16 June 2009 20:48, PJ advised: > Now, I was happy to learn that it is simpler to populate the > insert new > books page dynamically from the db. Much shorter & neater. > It looks to me like the best solution for the edit page is > close to what > Yuri suggests. > Since the edit page is very si

RE: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread Yuri Yarlei
2009 10:16:15 +0100 > From: m.f...@leedsmet.ac.uk > To: php-general@lists.php.net > Subject: RE: [PHP] populate form input option dropdown box from existing data > > On 16 June 2009 20:48, PJ advised: > > > Now, I was happy to learn that it is simpler to populate the > > in

RE: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread Yuri Yarlei
20:46:29 -0400 > From: af.gour...@videotron.ca > To: a...@ashleysheridan.co.uk > CC: gargari...@hotmail.com; m...@dajve.co.uk; php-general@lists.php.net; > tedd.sperl...@gmail.com; nos...@mckenzies.net > Subject: Re: [PHP] populate form input option dropdown box from > existing

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread PJ
Ashley Sheridan wrote: > On Tue, 2009-06-16 at 20:46 -0400, PJ wrote: > >> Ashley Sheridan wrote: >> >>> On Tue, 2009-06-16 at 18:19 -0400, PJ wrote: >>> >>> Ashley Sheridan wrote: > On Tue, 2009-06-16 at 15:48 -0400, PJ wrote: > >

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread PJ
Ford, Mike wrote: > On 16 June 2009 20:48, PJ advised: > >> Now, I was happy to learn that it is simpler to populate the >> insert new >> books page dynamically from the db. Much shorter & neater. >> It looks to me like the best solution for the edit page is >> close to what >> Yuri suggests. >> Si

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread Ashley Sheridan
On Wed, 2009-06-17 at 10:01 -0400, PJ wrote: > Ford, Mike wrote: > > On 16 June 2009 20:48, PJ advised: > > > >> Now, I was happy to learn that it is simpler to populate the > >> insert new > >> books page dynamically from the db. Much shorter & neater. > >> It looks to me like the best solution fo

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread Shawn McKenzie
PJ wrote: > It does, indeed. This confirms my inexperienced conclusion that > in_array() does not work on associative arrays per se; it works on > simple arrays and I just don't have the experience to think of > extracting only the id fields. > I actually am using a slightly more complicated if els

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread PJ
Ashley Sheridan wrote: > On Wed, 2009-06-17 at 10:01 -0400, PJ wrote: > >> Ford, Mike wrote: >> >>> On 16 June 2009 20:48, PJ advised: >>> >>> Now, I was happy to learn that it is simpler to populate the insert new books page dynamically from the db. Much shorter & nea

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread Shawn McKenzie
PJ wrote: > Ashley Sheridan wrote: >> On Wed, 2009-06-17 at 10:01 -0400, PJ wrote: >> >>> Ford, Mike wrote: >>> On 16 June 2009 20:48, PJ advised: > Now, I was happy to learn that it is simpler to populate the > insert new > books page dynamically from the

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread Ashley Sheridan
On Wed, 2009-06-17 at 16:29 -0400, PJ wrote: > Ashley Sheridan wrote: > > On Wed, 2009-06-17 at 10:01 -0400, PJ wrote: > > > >> Ford, Mike wrote: > >> > >>> On 16 June 2009 20:48, PJ advised: > >>> > >>> > Now, I was happy to learn that it is simpler to populate the > inser

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread PJ
;", $row['category'], ""; } } I think it will work now. Thanks much for the input & the support. :-) > > > >> Date: Wed, 17 Jun 2009 10:16:15 +0100 >> From: m.f...@leedsmet.ac.uk >> To: php-general@lists.php.net >>

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread PJ
Shawn McKenzie wrote: > PJ wrote: >> Ashley Sheridan wrote: >>> On Wed, 2009-06-17 at 10:01 -0400, PJ wrote: >>> Ford, Mike wrote: > On 16 June 2009 20:48, PJ advised: > > >> Now, I was happy to learn that it is simpler to populate the >> insert new >> books page d

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread Stuart
Oops, hit reply instead of reply to all. Sorry for the duplicate PJ. 2009/6/17 PJ : > Shawn McKenzie wrote: >> PJ wrote: >>> Ashley Sheridan wrote: On Wed, 2009-06-17 at 10:01 -0400, PJ wrote: > Ford, Mike wrote: > >> On 16 June 2009 20:48, PJ advised: >> >> >>> N

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread PJ
I snipped to make it short... continue at bottom... > Step back from the code and consider the steps you need to perform... > > 1) Get an array of the categories, ideally in the form $cats[] > = categoryname. > > 2) Get an array of the category IDs that should be selected, i.e. > $selectedcats = ar

Re: [PHP] populate form input option dropdown box from existing data

2009-06-17 Thread Stuart
2009/6/18 PJ : > I snipped to make it short... continue at bottom... >> Step back from the code and consider the steps you need to perform... >> >> 1) Get an array of the categories, ideally in the form $cats[] >> = categoryname. >> >> 2) Get an array of the category IDs that should be selected, i.

RE: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread Ford, Mike
On 17 June 2009 15:01, PJ advised: > It does, indeed. This confirms my inexperienced conclusion that > in_array() does not work on associative arrays per se; it works on > simple arrays and I just don't have the experience to think of > extracting only the id fields. Let's squash this misconcepti

RE: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread Ford, Mike
On 17 June 2009 14:30, PJ advised: > For the moment, I am trying to resolve the problem of > extracting a value > from a string returned by a query. I thought that in_array() would do > it, but the tests I have run on it are 100% negative. The only thing I > have not used in the tests is third pa

Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread Peter Ford
PJ wrote: > I'm including the relevant code: > > // select categories for book to be updated > $sql = "SELECT id, category FROM categories, book_categories > WHERE book_categories.bookID = '$bid' && > book_categories.categories_id = categories.id"; > if ( ( $results = mysql_query($sql, $db

Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread PJ
Stuart wrote: > 2009/6/18 PJ : > >> I snipped to make it short... continue at bottom... >> >>> Step back from the code and consider the steps you need to perform... >>> >>> 1) Get an array of the categories, ideally in the form $cats[] >>> = categoryname. >>> >>> 2) Get an array of the cate

Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread Stuart
2009/6/18 PJ : > Stuart wrote: >> 2009/6/18 PJ : >> >>> I snipped to make it short... continue at bottom... >>> Step back from the code and consider the steps you need to perform... 1) Get an array of the categories, ideally in the form $cats[] = categoryname. 2) Get a

Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread PJ
Ford, Mike wrote: > On 17 June 2009 15:01, PJ advised: > > >> It does, indeed. This confirms my inexperienced conclusion that >> in_array() does not work on associative arrays per se; it works on >> simple arrays and I just don't have the experience to think of >> extracting only the id fields.

Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread PJ
Ford, Mike wrote: > On 17 June 2009 14:30, PJ advised: > > > >> For the moment, I am trying to resolve the problem of >> extracting a value >> from a string returned by a query. I thought that in_array() would do >> it, but the tests I have run on it are 100% negative. The only thing I >> have n

Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread Martin Scotta
It is a sintax error if (in_array($ex, $selected) <--- missing ) echo "yes"; else echo "no"; On Thu, Jun 18, 2009 at 10:13 AM, PJ wrote: > Ford, Mike wrote: > > On 17 June 2009 14:30, PJ advised: > > > > > > > >> For the moment, I am trying to resolve the problem of > >> extracting a value >

Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread PJ
Martin Scotta wrote: > It is a sintax error > > if (in_array($ex, $selected) <--- missing ) > echo "yes"; > else echo "no"; > > On Thu, Jun 18, 2009 at 10:13 AM, PJ > wrote: > > Ford, Mike wrote: > > On 17 June 2009 14:30, PJ advised: > > > > >

Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread Stuart
2009/6/18 PJ : > Martin Scotta wrote: >> It is a sintax error >> >> if (in_array($ex, $selected)   <--- missing ) >> echo "yes"; >> else echo "no"; >> >> On Thu, Jun 18, 2009 at 10:13 AM, PJ > > wrote: >> >>     Ford, Mike wrote: >>     > On 17 June 2009 14:30, PJ ad

Re: [PHP] populate form input option dropdown box from existing data

2009-06-18 Thread PJ
Stuart wrote: > 2009/6/18 PJ : > >> Martin Scotta wrote: >> >>> It is a sintax error >>> >>> if (in_array($ex, $selected) <--- missing ) >>> echo "yes"; >>> else echo "no"; >>> >>> On Thu, Jun 18, 2009 at 10:13 AM, PJ >> > wrote: >>> >>> Ford, Mike wrot