Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AC7A99FA43F for ; Mon, 4 Dec 2006 13:59:21 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 47043-09 for ; Mon, 4 Dec 2006 13:59:13 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from web33304.mail.mud.yahoo.com (web33304.mail.mud.yahoo.com [68.142.206.119]) by postgresql.org (Postfix) with SMTP id 1B2F19FA2CB for ; Mon, 4 Dec 2006 13:59:13 -0400 (AST) Received: (qmail 12203 invoked by uid 60001); 4 Dec 2006 17:59:11 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type; b=MB/WCK64uEMWuUjILq1N937oE2Zpz3tPz9X7XlYFCCYxyZ1whbJCKCJRdhAhQoB6L/Y13fc/GPInZpeRtTvUupU6BL380zpQ1X0ZG5dXAvmHBo/vJbpjB9I48Ja+J0DiYboxabpKiZnti0cdiEUlja7bt4jfulukrxP5yOLwdSU= ; Message-ID: <20061204175911.12201.qmail@web33304.mail.mud.yahoo.com> Received: from [12.9.179.126] by web33304.mail.mud.yahoo.com via HTTP; Mon, 04 Dec 2006 09:59:11 PST Date: Mon, 4 Dec 2006 09:59:11 -0800 (PST) From: Subject: Re: HTML FORMS selected question To: Mag Gam , pgsql-php@postgresql.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-436170247-1165255151=:11557" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=3.492 tagged_above=0 required=5 tests=AWL, BAYES_05, DNS_FROM_RFC_ABUSE, DNS_FROM_RFC_POST, DNS_FROM_RFC_WHOIS, HTML_30_40, HTML_MESSAGE, NO_REAL_NAME X-Spam-Level: *** X-Archive-Number: 200612/10 X-Sequence-Number: 3678 --0-436170247-1165255151=:11557 Content-Type: text/plain; charset=ascii Content-Transfer-Encoding: quoted-printable ----- Original Message ----=0AFrom: Mag Gam =0ATo: pgsq= l-php@postgresql.org=0ASent: Sunday, December 3, 2006 2:42:36 PM=0ASubject:= [PHP] HTML FORMS selected question=0A=0AI am having trouble getting values= populated in my form... Here is what I got so far:=0A=0A//The values that = need to be selected=0A$result_ip=3Dpg_query($dbconn,$test_query);=0A=0A=0A=0A $option) {=0A if ($rows[1]=3D=3D$option)=0A {=0Aecho "$rows[1] \n"; =0A= =0Abreak;=0A }=0Aelse=0A{=0A echo " \n"; =0A break;=0A}=0A}=0A}=0A=0AWhat am I doing wrong?= =0A=0ATIA!=0A=0A---------------------------=0A=0AMag, i'm not sure what is = wrong with the specific code, however, i'll make a suggestion that i think = will help you more than just resolving this issue.=0A=0Ai recommend you loo= k into learning a forms class. the code will be much cleaner and the thoug= ht process is much more obvious. the icing on the cake is the increased fu= nctionality you will get "out of the box" because some smart person coded i= t right into their forms class. for example, i get client side and server = side error checking and error message reporting. i also get to have my for= m give focus to the first element via javascript. there is some ajaxy stuf= f i haven't learned yet, but it is available.=0A=0Ai use Manuel Lemos' free= forms generation and validation class which can be found on phpclasses.org= . iirc, the license is such that it can be included in proprietary commerc= ial applications. there are others, too. i believe pear has one, along wi= th some other functionality.=0A=0Ai'm very glad i went with a forms class i= nstead of "htmling" it all. i think you will be, too.=0A=0AManuel has a ya= hoo mailing list that is very helpful and reasonably active. Most question= s are answered within a day or so.=0A=0Agood luck.=0A=0A=0A=0A=0A=0A =0A___= ___________________________________________________________________________= ______=0ADo you Yahoo!?=0AEveryone is raving about the all-new Yahoo! Mail = beta.=0Ahttp://new.mail.yahoo.com --0-436170247-1165255151=:11557 Content-Type: text/html; charset=ascii Content-Transfer-Encoding: quoted-printable
----- Original Message ----
From: Mag Ga= m <magawake@gmail.com>
To: pgsql-php@postgresql.org
Sent: Sunda= y, December 3, 2006 2:42:36 PM
Subject: [PHP] HTML FORMS selected questi= on

I am having trouble getting values populated in my form... Here i= s what I got so far:

//The values that need to be selected
$resul= t_ip=3Dpg_query($dbconn,$test_query);

<SELECT    N= AME=3D"ip[]" SIZE=3D10 MULTIPLE>=0A
<?php
//This will show ALL= values.
while($rows=3Dpg_fetch_array($result)){
foreach ($options as= $index =3D> $option) {
    if ($rows[1]=3D=3D$option)=
    {
echo "<OptioN VALUE=3D\"$rows[0]\" selected= =3D\"selected\">$rows[1]</Option> \n"; =0A
break;
 &nbs= p;      }
else
{
    echo "<= OPTION VALUE=3D\"$rows[0]\">$rows[1]</OPTION> \n";
  = ;  break;
}
}
}

What am I doing wrong?

TIA!
=
---------------------------

Mag, i'm not sure what is wrong with= the specific code, however, i'll make a suggestion that i think will help = you more than just resolving this issue.

i recommend you look into l= earning a forms class.  the code will be much cleaner and the thought = process is much more obvious.  the icing on the cake is the increased = functionality you will get "out of the box" because some smart person coded= it right into their forms class.  for example, i get client side and = server side error checking and error message reporting.  i also get to= have my form give focus to the first element via javascript.  there i= s some ajaxy stuff i haven't learned yet, but it is available.

i use Manuel Lemos' free forms generation and validation= class which can be found on phpclasses.org.  iirc, the license is suc= h that it can be included in proprietary commercial applications.  the= re are others, too.  i believe pear has one, along with some other fun= ctionality.

i'm very glad i went with a forms class instead of "html= ing" it all.  i think you will be, too.

Manuel has a yahoo mail= ing list that is very helpful and reasonably active.  Most questions a= re answered within a day or so.

good luck.

= =0A=0A
Have a burning question? Go to Yahoo! Answers and get answers fr= om real people who know. --0-436170247-1165255151=:11557--