[PHP] RE: (HTML related) helping to creating dropdown lists from fetched arrays.

2002-02-24 Thread Matthew Darcy

it does help a little.

I know the html is wrong I used this as an example to what I wanted.

What I need to know is how to use PHP to generate the options in the list
from col1 and show the option 2.
The data for these is got from an array.

so really what I want to know is how to code in PHP


select name=test drop down
  option value=col1($row1)col2($row1)
  option value=col1($row2)col2($row2)
  option value=col1($row3)col2($row3)
/select

you get the idea ?

Thanks,

Matt.




-Original Message-
From: Cece [mailto:[EMAIL PROTECTED]]On Behalf Of Heilig (Cece) Szabolcs
Sent: 24 February 2002 23:07
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: OT:(HTML related) helping to creating dropdown lists from
fetched arrays.


 I want to create a dropdown list with options from a table.

 ?php

 $sql_select = select * from dropdown_options;
 $results = mysql_query($sql
 _select);

 while ($row = mysql_fetch_array($results);
 {
   echo option VALUE=$row[col1] NAME=option1
 }

Hi!

The problem is simple: wrong HTML
You have to make html code similar that:

select name=gender
  option value=Ffemale
  option value=Mmale
  option value=0not known :)
/select

Hope it helps

Cece


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched arrays.

2002-02-24 Thread Martin Towell

try this: (I don't have experience w/ mysql, but I do with other dbs)

select name=test drop down
?php
$sql_select = select * from dropdown_options;
$results = mysql_query($sql_select);
while ($row = mysql_fetch_array($results);
{
  echo option VALUE=.$row[col1]..$row[col2];
}
?
/select

-Original Message-
From: Matthew Darcy [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 25, 2002 10:06 AM
To: [EMAIL PROTECTED]
Subject: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


it does help a little.

I know the html is wrong I used this as an example to what I wanted.

What I need to know is how to use PHP to generate the options in the list
from col1 and show the option 2.
The data for these is got from an array.

so really what I want to know is how to code in PHP


select name=test drop down
  option value=col1($row1)col2($row1)
  option value=col1($row2)col2($row2)
  option value=col1($row3)col2($row3)
/select

you get the idea ?

Thanks,

Matt.




-Original Message-
From: Cece [mailto:[EMAIL PROTECTED]]On Behalf Of Heilig (Cece) Szabolcs
Sent: 24 February 2002 23:07
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: OT:(HTML related) helping to creating dropdown lists from
fetched arrays.


 I want to create a dropdown list with options from a table.

 ?php

 $sql_select = select * from dropdown_options;
 $results = mysql_query($sql
 _select);

 while ($row = mysql_fetch_array($results);
 {
   echo option VALUE=$row[col1] NAME=option1
 }

Hi!

The problem is simple: wrong HTML
You have to make html code similar that:

select name=gender
  option value=Ffemale
  option value=Mmale
  option value=0not known :)
/select

Hope it helps

Cece


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched arrays.

2002-02-24 Thread Matthew Darcy

RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched
arrays.Thanks Martin.

That looks perfect.
I have adaprted what you sent to use in my test application and I am getting
an error on line 22 which is the $row= line.

Take a look and see if you can spot my error as it all looks fine to me
(again )

Thanks,

Matt.

HTML

HEAD

META NAME=GENERATOR Content=vi

TITLE Search for food/TITLE

/HEAD

BODY BGCOLOR=#ff

CENTER

TABLE BGCOLOR=#191970 WIDTH=400 HEIGHT=20

TR WIDTH=400 HEIGHT=10 BGCOLOR=#ff9900

TD WIDTH=400 FACE=arial SIZE=4 COLOR=#191970CENTER food Search
/CENTER/FONT/TD

/TR

TR HEIGHT=40 WIDTH=400

TDFONT FACE=arial SIZE=3 COLOR=#ff9900 select
name=food_type_drop_down

?php

$sql_select_food_type=select * from food_type_menu;

$results=mysql_query($sql_select_food_type);

while ($row = mysql_fetch_array($results);

{

echo option VALUE=.$row[food_search_field]..$row[food_type];

}

?

/select

/TD

/TABLE

/BODY

/HTML

  -Original Message-
  From: Martin Towell [mailto:[EMAIL PROTECTED]]
  Sent: 24 February 2002 23:13
  To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
  Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


  try this: (I don't have experience w/ mysql, but I do with other dbs)

  select name=test drop down
  ?php
  $sql_select = select * from dropdown_options;
  $results = mysql_query($sql_select);
  while ($row = mysql_fetch_array($results);
  {
echo option VALUE=.$row[col1]..$row[col2];
  }
  ?
  /select

  -Original Message-
  From: Matthew Darcy [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 25, 2002 10:06 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] RE: (HTML related) helping to creating dropdown lists
  from fetched arrays.



  it does help a little.

  I know the html is wrong I used this as an example to what I wanted.

  What I need to know is how to use PHP to generate the options in the list
  from col1 and show the option 2.
  The data for these is got from an array.

  so really what I want to know is how to code in PHP



  select name=test drop down
option value=col1($row1)col2($row1)
option value=col1($row2)col2($row2)
option value=col1($row3)col2($row3)
  /select

  you get the idea ?

  Thanks,

  Matt.





  -Original Message-
  From: Cece [mailto:[EMAIL PROTECTED]]On Behalf Of Heilig (Cece) Szabolcs
  Sent: 24 February 2002 23:07
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: OT:(HTML related) helping to creating dropdown lists from
  fetched arrays.



   I want to create a dropdown list with options from a table.

   ?php
  
   $sql_select = select * from dropdown_options;
   $results = mysql_query($sql
   _select);
  
   while ($row = mysql_fetch_array($results);
   {
 echo option VALUE=$row[col1] NAME=option1
   }

  Hi!

  The problem is simple: wrong HTML
  You have to make html code similar that:

  select name=gender
option value=Ffemale
option value=Mmale
option value=0not known :)
  /select

  Hope it helps

  Cece



  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched arrays.

2002-02-24 Thread Martin Towell

original line:
while ($row = mysql_fetch_array($results);
new line:
while ($row = mysql_fetch_array($results))

-Original Message-
From: Matthew Darcy [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 25, 2002 10:37 AM
To: Martin Towell; [EMAIL PROTECTED]
Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched
arrays.Thanks Martin.

That looks perfect.
I have adaprted what you sent to use in my test application and I am getting
an error on line 22 which is the $row= line.

Take a look and see if you can spot my error as it all looks fine to me
(again )

Thanks,

Matt.

HTML

HEAD

META NAME=GENERATOR Content=vi

TITLE Search for food/TITLE

/HEAD

BODY BGCOLOR=#ff

CENTER

TABLE BGCOLOR=#191970 WIDTH=400 HEIGHT=20

TR WIDTH=400 HEIGHT=10 BGCOLOR=#ff9900

TD WIDTH=400 FACE=arial SIZE=4 COLOR=#191970CENTER food Search
/CENTER/FONT/TD

/TR

TR HEIGHT=40 WIDTH=400

TDFONT FACE=arial SIZE=3 COLOR=#ff9900 select
name=food_type_drop_down

?php

$sql_select_food_type=select * from food_type_menu;

$results=mysql_query($sql_select_food_type);

while ($row = mysql_fetch_array($results);

{

echo option VALUE=.$row[food_search_field]..$row[food_type];

}

?

/select

/TD

/TABLE

/BODY

/HTML

  -Original Message-
  From: Martin Towell [mailto:[EMAIL PROTECTED]]
  Sent: 24 February 2002 23:13
  To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
  Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


  try this: (I don't have experience w/ mysql, but I do with other dbs)

  select name=test drop down
  ?php
  $sql_select = select * from dropdown_options;
  $results = mysql_query($sql_select);
  while ($row = mysql_fetch_array($results);
  {
echo option VALUE=.$row[col1]..$row[col2];
  }
  ?
  /select

  -Original Message-
  From: Matthew Darcy [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 25, 2002 10:06 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] RE: (HTML related) helping to creating dropdown lists
  from fetched arrays.



  it does help a little.

  I know the html is wrong I used this as an example to what I wanted.

  What I need to know is how to use PHP to generate the options in the list
  from col1 and show the option 2.
  The data for these is got from an array.

  so really what I want to know is how to code in PHP



  select name=test drop down
option value=col1($row1)col2($row1)
option value=col1($row2)col2($row2)
option value=col1($row3)col2($row3)
  /select

  you get the idea ?

  Thanks,

  Matt.





  -Original Message-
  From: Cece [mailto:[EMAIL PROTECTED]]On Behalf Of Heilig (Cece) Szabolcs
  Sent: 24 February 2002 23:07
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: OT:(HTML related) helping to creating dropdown lists from
  fetched arrays.



   I want to create a dropdown list with options from a table.

   ?php
  
   $sql_select = select * from dropdown_options;
   $results = mysql_query($sql
   _select);
  
   while ($row = mysql_fetch_array($results);
   {
 echo option VALUE=$row[col1] NAME=option1
   }

  Hi!

  The problem is simple: wrong HTML
  You have to make html code similar that:

  select name=gender
option value=Ffemale
option value=Mmale
option value=0not known :)
  /select

  Hope it helps

  Cece



  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched arrays.

2002-02-24 Thread Matthew Darcy

RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched
arrays.genius - didn't notice that, forgot to close the query.

Thanks,

Matt.

  -Original Message-
  From: Martin Towell [mailto:[EMAIL PROTECTED]]
  Sent: 24 February 2002 23:43
  To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
  Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


  original line:
  while ($row = mysql_fetch_array($results);
  new line:
  while ($row = mysql_fetch_array($results))

  -Original Message-
  From: Matthew Darcy [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 25, 2002 10:37 AM
  To: Martin Towell; [EMAIL PROTECTED]
  Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
  from fetched arrays.



  RE: [PHP] RE: (HTML related) helping to creating dropdown lists from
fetched
  arrays.Thanks Martin.

  That looks perfect.
  I have adaprted what you sent to use in my test application and I am
getting
  an error on line 22 which is the $row= line.

  Take a look and see if you can spot my error as it all looks fine to me
  (again )

  Thanks,

  Matt.

  HTML

  HEAD

  META NAME=GENERATOR Content=vi

  TITLE Search for food/TITLE

  /HEAD

  BODY BGCOLOR=#ff

  CENTER

  TABLE BGCOLOR=#191970 WIDTH=400 HEIGHT=20

  TR WIDTH=400 HEIGHT=10 BGCOLOR=#ff9900

  TD WIDTH=400 FACE=arial SIZE=4 COLOR=#191970CENTER food Search
  /CENTER/FONT/TD

  /TR

  TR HEIGHT=40 WIDTH=400

  TDFONT FACE=arial SIZE=3 COLOR=#ff9900 select
  name=food_type_drop_down

  ?php

  $sql_select_food_type=select * from food_type_menu;

  $results=mysql_query($sql_select_food_type);

  while ($row = mysql_fetch_array($results);

  {

  echo option VALUE=.$row[food_search_field]..$row[food_type];

  }

  ?

  /select

  /TD

  /TABLE

  /BODY

  /HTML

-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: 24 February 2002 23:13
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
  from fetched arrays.



try this: (I don't have experience w/ mysql, but I do with other dbs)

select name=test drop down
?php
$sql_select = select * from dropdown_options;
$results = mysql_query($sql_select);
while ($row = mysql_fetch_array($results);
{
  echo option VALUE=.$row[col1]..$row[col2];
}
?
/select

-Original Message-
From: Matthew Darcy [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 25, 2002 10:06 AM
To: [EMAIL PROTECTED]
Subject: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.




it does help a little.

I know the html is wrong I used this as an example to what I wanted.

What I need to know is how to use PHP to generate the options in the
list
from col1 and show the option 2.
The data for these is got from an array.

so really what I want to know is how to code in PHP




select name=test drop down
  option value=col1($row1)col2($row1)
  option value=col1($row2)col2($row2)
  option value=col1($row3)col2($row3)
/select

you get the idea ?

Thanks,

Matt.






-Original Message-
From: Cece [mailto:[EMAIL PROTECTED]]On Behalf Of Heilig (Cece) Szabolcs
Sent: 24 February 2002 23:07
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: OT:(HTML related) helping to creating dropdown lists from
fetched arrays.




 I want to create a dropdown list with options from a table.

 ?php

 $sql_select = select * from dropdown_options;
 $results = mysql_query($sql
 _select);

 while ($row = mysql_fetch_array($results);
 {
   echo option VALUE=$row[col1] NAME=option1
 }

Hi!

The problem is simple: wrong HTML
You have to make html code similar that:

select name=gender
  option value=Ffemale
  option value=Mmale
  option value=0not known :)
/select

Hope it helps

Cece




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched arrays.

2002-02-24 Thread Matthew Darcy

Getting there now...

all looks well, very tidy etc.

However my drop down box is empty ?? I know there is data in the table I am
running the select on though ???

Any ideas ?

Thanks,

Matt.


-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: 24 February 2002 23:43
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


original line:
while ($row = mysql_fetch_array($results);
new line:
while ($row = mysql_fetch_array($results))

-Original Message-
From: Matthew Darcy [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 25, 2002 10:37 AM
To: Martin Towell; [EMAIL PROTECTED]
Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched
arrays.Thanks Martin.

That looks perfect.
I have adaprted what you sent to use in my test application and I am getting
an error on line 22 which is the $row= line.

Take a look and see if you can spot my error as it all looks fine to me
(again )

Thanks,

Matt.

HTML

HEAD

META NAME=GENERATOR Content=vi

TITLE Search for food/TITLE

/HEAD

BODY BGCOLOR=#ff

CENTER

TABLE BGCOLOR=#191970 WIDTH=400 HEIGHT=20

TR WIDTH=400 HEIGHT=10 BGCOLOR=#ff9900

TD WIDTH=400 FACE=arial SIZE=4 COLOR=#191970CENTER food Search
/CENTER/FONT/TD

/TR

TR HEIGHT=40 WIDTH=400

TDFONT FACE=arial SIZE=3 COLOR=#ff9900 select
name=food_type_drop_down

?php

$sql_select_food_type=select * from food_type_menu;

$results=mysql_query($sql_select_food_type);

while ($row = mysql_fetch_array($results);

{

echo option VALUE=.$row[food_search_field]..$row[food_type];

}

?

/select

/TD

/TABLE

/BODY

/HTML

  -Original Message-
  From: Martin Towell [mailto:[EMAIL PROTECTED]]
  Sent: 24 February 2002 23:13
  To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
  Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


  try this: (I don't have experience w/ mysql, but I do with other dbs)

  select name=test drop down
  ?php
  $sql_select = select * from dropdown_options;
  $results = mysql_query($sql_select);
  while ($row = mysql_fetch_array($results);
  {
echo option VALUE=.$row[col1]..$row[col2];
  }
  ?
  /select

  -Original Message-
  From: Matthew Darcy [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 25, 2002 10:06 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] RE: (HTML related) helping to creating dropdown lists
  from fetched arrays.



  it does help a little.

  I know the html is wrong I used this as an example to what I wanted.

  What I need to know is how to use PHP to generate the options in the list
  from col1 and show the option 2.
  The data for these is got from an array.

  so really what I want to know is how to code in PHP



  select name=test drop down
option value=col1($row1)col2($row1)
option value=col1($row2)col2($row2)
option value=col1($row3)col2($row3)
  /select

  you get the idea ?

  Thanks,

  Matt.





  -Original Message-
  From: Cece [mailto:[EMAIL PROTECTED]]On Behalf Of Heilig (Cece) Szabolcs
  Sent: 24 February 2002 23:07
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: OT:(HTML related) helping to creating dropdown lists from
  fetched arrays.



   I want to create a dropdown list with options from a table.

   ?php
  
   $sql_select = select * from dropdown_options;
   $results = mysql_query($sql
   _select);
  
   while ($row = mysql_fetch_array($results);
   {
 echo option VALUE=$row[col1] NAME=option1
   }

  Hi!

  The problem is simple: wrong HTML
  You have to make html code similar that:

  select name=gender
option value=Ffemale
option value=Mmale
option value=0not known :)
  /select

  Hope it helps

  Cece



  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched arrays.

2002-02-24 Thread Matthew Darcy

apologies,

my fault forgot to include the dbconnect at the top of the page. I was
trying to access the database without loggin onto it.

Sorry all.

Matt.


-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: 24 February 2002 23:43
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


original line:
while ($row = mysql_fetch_array($results);
new line:
while ($row = mysql_fetch_array($results))

-Original Message-
From: Matthew Darcy [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 25, 2002 10:37 AM
To: Martin Towell; [EMAIL PROTECTED]
Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched
arrays.Thanks Martin.

That looks perfect.
I have adaprted what you sent to use in my test application and I am getting
an error on line 22 which is the $row= line.

Take a look and see if you can spot my error as it all looks fine to me
(again )

Thanks,

Matt.

HTML

HEAD

META NAME=GENERATOR Content=vi

TITLE Search for food/TITLE

/HEAD

BODY BGCOLOR=#ff

CENTER

TABLE BGCOLOR=#191970 WIDTH=400 HEIGHT=20

TR WIDTH=400 HEIGHT=10 BGCOLOR=#ff9900

TD WIDTH=400 FACE=arial SIZE=4 COLOR=#191970CENTER food Search
/CENTER/FONT/TD

/TR

TR HEIGHT=40 WIDTH=400

TDFONT FACE=arial SIZE=3 COLOR=#ff9900 select
name=food_type_drop_down

?php

$sql_select_food_type=select * from food_type_menu;

$results=mysql_query($sql_select_food_type);

while ($row = mysql_fetch_array($results);

{

echo option VALUE=.$row[food_search_field]..$row[food_type];

}

?

/select

/TD

/TABLE

/BODY

/HTML

  -Original Message-
  From: Martin Towell [mailto:[EMAIL PROTECTED]]
  Sent: 24 February 2002 23:13
  To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
  Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


  try this: (I don't have experience w/ mysql, but I do with other dbs)

  select name=test drop down
  ?php
  $sql_select = select * from dropdown_options;
  $results = mysql_query($sql_select);
  while ($row = mysql_fetch_array($results);
  {
echo option VALUE=.$row[col1]..$row[col2];
  }
  ?
  /select

  -Original Message-
  From: Matthew Darcy [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 25, 2002 10:06 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] RE: (HTML related) helping to creating dropdown lists
  from fetched arrays.



  it does help a little.

  I know the html is wrong I used this as an example to what I wanted.

  What I need to know is how to use PHP to generate the options in the list
  from col1 and show the option 2.
  The data for these is got from an array.

  so really what I want to know is how to code in PHP



  select name=test drop down
option value=col1($row1)col2($row1)
option value=col1($row2)col2($row2)
option value=col1($row3)col2($row3)
  /select

  you get the idea ?

  Thanks,

  Matt.





  -Original Message-
  From: Cece [mailto:[EMAIL PROTECTED]]On Behalf Of Heilig (Cece) Szabolcs
  Sent: 24 February 2002 23:07
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: OT:(HTML related) helping to creating dropdown lists from
  fetched arrays.



   I want to create a dropdown list with options from a table.

   ?php
  
   $sql_select = select * from dropdown_options;
   $results = mysql_query($sql
   _select);
  
   while ($row = mysql_fetch_array($results);
   {
 echo option VALUE=$row[col1] NAME=option1
   }

  Hi!

  The problem is simple: wrong HTML
  You have to make html code similar that:

  select name=gender
option value=Ffemale
option value=Mmale
option value=0not known :)
  /select

  Hope it helps

  Cece



  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched arrays.

2002-02-24 Thread Matthew Darcy

fixed the connection problem,

I am still getting no output to the option menu.

The output HTML page looks like this.


HTML

HEAD
META NAME=GENERATOR Content=vi
TITLEThe Search Page/TITLE
/HEAD
BODY BGCOLOR=white
CENTER



TABLE BGCOLOR=#191970 WIDTH=400 HEIGHT=20
TR WIDTH=400 HEIGHT=10  BGCOLOR=#ff9900
TD WIDTH=380FONT FACE=arial SIZE=4 COLOR=#191970CENTER food 
Search
/CENTER/TD
/TR
TR HEIGHT=40
TDFONT FACE=arial SIZE=3 COLOR=#ff9900 SELECT
NAME=food_type_drop_down
option VALUE=/TD
/select
/TR
/TABLE
/TABLE
/CENTER
/BODY
/HTML

if I do a select * from food_type_menu;
at the sql prompt it returns 4 rows. as this is the same sql query I run in
the php script I would expect it to return 4 rows also ? I am a little lost
to why my menu has no options.

Thanks,

Matt.


-Original Message-
From: Martin Towell [mailto:[EMAIL PROTECTED]]
Sent: 24 February 2002 23:43
To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


original line:
while ($row = mysql_fetch_array($results);
new line:
while ($row = mysql_fetch_array($results))

-Original Message-
From: Matthew Darcy [mailto:[EMAIL PROTECTED]]
Sent: Monday, February 25, 2002 10:37 AM
To: Martin Towell; [EMAIL PROTECTED]
Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


RE: [PHP] RE: (HTML related) helping to creating dropdown lists from fetched
arrays.Thanks Martin.

That looks perfect.
I have adaprted what you sent to use in my test application and I am getting
an error on line 22 which is the $row= line.

Take a look and see if you can spot my error as it all looks fine to me
(again )

Thanks,

Matt.

HTML

HEAD

META NAME=GENERATOR Content=vi

TITLE Search for food/TITLE

/HEAD

BODY BGCOLOR=#ff

CENTER

TABLE BGCOLOR=#191970 WIDTH=400 HEIGHT=20

TR WIDTH=400 HEIGHT=10 BGCOLOR=#ff9900

TD WIDTH=400 FACE=arial SIZE=4 COLOR=#191970CENTER food Search
/CENTER/FONT/TD

/TR

TR HEIGHT=40 WIDTH=400

TDFONT FACE=arial SIZE=3 COLOR=#ff9900 select
name=food_type_drop_down

?php

$sql_select_food_type=select * from food_type_menu;

$results=mysql_query($sql_select_food_type);

while ($row = mysql_fetch_array($results);

{

echo option VALUE=.$row[food_search_field]..$row[food_type];

}

?

/select

/TD

/TABLE

/BODY

/HTML

  -Original Message-
  From: Martin Towell [mailto:[EMAIL PROTECTED]]
  Sent: 24 February 2002 23:13
  To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED]
  Subject: RE: [PHP] RE: (HTML related) helping to creating dropdown lists
from fetched arrays.


  try this: (I don't have experience w/ mysql, but I do with other dbs)

  select name=test drop down
  ?php
  $sql_select = select * from dropdown_options;
  $results = mysql_query($sql_select);
  while ($row = mysql_fetch_array($results);
  {
echo option VALUE=.$row[col1]..$row[col2];
  }
  ?
  /select

  -Original Message-
  From: Matthew Darcy [mailto:[EMAIL PROTECTED]]
  Sent: Monday, February 25, 2002 10:06 AM
  To: [EMAIL PROTECTED]
  Subject: [PHP] RE: (HTML related) helping to creating dropdown lists
  from fetched arrays.



  it does help a little.

  I know the html is wrong I used this as an example to what I wanted.

  What I need to know is how to use PHP to generate the options in the list
  from col1 and show the option 2.
  The data for these is got from an array.

  so really what I want to know is how to code in PHP



  select name=test drop down
option value=col1($row1)col2($row1)
option value=col1($row2)col2($row2)
option value=col1($row3)col2($row3)
  /select

  you get the idea ?

  Thanks,

  Matt.





  -Original Message-
  From: Cece [mailto:[EMAIL PROTECTED]]On Behalf Of Heilig (Cece) Szabolcs
  Sent: 24 February 2002 23:07
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: OT:(HTML related) helping to creating dropdown lists from
  fetched arrays.



   I want to create a dropdown list with options from a table.

   ?php
  
   $sql_select = select * from dropdown_options;
   $results = mysql_query($sql
   _select);
  
   while ($row = mysql_fetch_array($results);
   {
 echo option VALUE=$row[col1] NAME=option1
   }

  Hi!

  The problem is simple: wrong HTML
  You have to make html code similar that:

  select name=gender
option value=Ffemale
option value=Mmale
option value=0not known :)
  /select

  Hope it helps

  Cece



  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php