forms /selects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hi all

I am trying to do a select from a table after the user has choosen the first
letter of the name and it must display only the names with that letter selected
in a select box. The message i get is if i select a for example is:
"the atribute 'a' not found"

I would like some help to know what?s going wrong!
Thank?s in advance

Ângelo Rigo

Here is my code:

Search names by the first letter
		<BR><form method="post" size="1" action="<?php print("$PHP_SELF"); ?>">
		<select size="1" name="leter">
						<option selected>Choose an initial leter
						<option value=A>A
						<option value=B>B
						<option value=C>C
						<option value=D>D
						<option value=E>E
						<option value=F>F
						<option value=G>G
						<option value=H>H
						<option value=I>I
						<option value=J>J
						<option value=K>K
						<option value=L>L
						<option value=M>M
						<option value=N>N
						<option value=O>O
						<option value=P>P
						<option value=Q>Q
						<option value=R>R
						<option value=S>S
						<option value=T>T
						<option value=U>U
						<option value=V>V
						<option value=X>X
						<option value=Y>Y
						<option value=Z>Z
						</select><input type="submit" value="Submit"></form></TD>
      </TR>
      </TABLE> <br>
 <?php
$db = pg_connect("dbname=db user=user");
$query ="SELECT name FROM thetable WHERE (nome=$leter%) ORDER BY nome ASC
";
$result = pg_exec($db, $query);

if (!$result) {printf ("Error!"); exit;}
$numrows = pg_numrows($result);
$row=0;
printf ("<table border=0>");
printf ("<tr bgcolor='#FFFF33'><td><b>Name</b></td></tr>");
do
{
$myrow = pg_fetch_array ($result,$row);
	if($row  % 2)	{
		$bgcolor="#FFFF99";
		}
	else  {
		$bgcolor="";
		}
printf ("<tr bgcolor='$bgcolor'><td>%s</td></tr>",$myrow[nome]);
$row++;
}
while ($row < $numrows);
printf ("</table>");
pg_close($db);
?>

________________________________________
A busca mais veloz e precisa da internet. Acesse agora: http://www.zoom.com.br.




[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux