pro_php thread: RE:---=?iso-8859-1?Q?=5F=5Bpro=5Fphp=5D=5FHow=5Fcant=B4=5Fread=5Fthe=5Fnames=5Fand=5Fvalues=5Foff=5Fa=5Fcombo=2Dbox?=
Ola Julio,
Yoor english is very good. I had the same problem when I started with php.
Here is a sample of the code for a drop box selection.
<center><b>Choose an ISD from the list provided:</b><br>
<?php
require 'common.inc';
mysql_select_db($database) or die("Unable to select $datbase");
echo ("<FORM METHOD='post' ACTION='page3.php3'>");
echo ("<SELECT NAME='myisdsel' SIZE='1'>");
$query = "SELECT * FROM isd ORDER BY isd_name";
$links = mysql_query($query) or die("<font color=red>Insert Failed! error-"
. mysql_error() . "<br>\nquery - $query</font>");
while ($myisd = mysql_fetch_array($links))
{
$isd_name = $myisd["isd_name"];
$id = $myisd["isd_id"];
echo "<OPTION VALUE=$id>$isd_name</OPTION>\n";
}
echo "(</SELECT><br>");
?>
<INPUT TYPE="submit" VALUE="Submit">
</CENTER>
</FORM>
Explaination:
MySQL table: isd
Fields retrieved from query: $id $isd_name
The $id of the selected item is stored in the select name, $myisdsel.
This can be used in the next page, ACTION='page3.php3'
If you need to place a specific item in as the first on the list. You can
add something like this;
if ($id = = $somevalue)
{
echo ("<OPTION VALUE='$clssub' SELECTED>$subname</OPTION>\n");
}
I hope this helps. I am just passing on what someone else taught me.
Richard D. Williams
Julio Oliveira wrote:
> Hi
> your spanish is better than my english
>
> Donīt worry i understand english from 40 years ago,
> but i donīt write very good.
>
> This is the problem.
>
> Iīm doing a web e-commerce.
> I have the client at the browser, and he has to do the
> new client.
>
> Name .... julio
> direc.... Gaona 3456 -
> city ................ (hear the problem)
>
> He has to select from a list
>
> Buenos Aires
> Capital
> New York
>
> I donīt want he see the numbers off the city that are
> at the server (mysql - table)
>
> At mysql-table i have a number like the key
>
> 0001BuenosAires ( a number and the first six
> elements)
> and the last six elements for
> security)
>
> When i take the listbox at the browser i donīt like to
> see the numbers off the key. He only see the names.
>
> When he take one at the browser, like Buenos Aires, y
> see that at the text in the browser, but i have to put
> the number at the table off the client.
>
> I do that with clipper at dos without problem.
>
> Canīt i have an array bidimensional (name and number)
> and see only the name at the listbox in the browse.
>
> Sorry by the lata (charla muy larga)
> contestame en ingles o en espaņol, si es espaņol mejor
> para que tu pratiques.
>
> Muchas gracias por tu tiempo
>
> Saludos
> Julio Oliveira - Buenos Aires - Argentina.
>