Re: passing variable arguments from <select>

From: Date: Thu, 27 Jun 2002 15:41:33 +0000
Subject: Re: passing variable arguments from <select>
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-104175@lists.php.net to get a copy of this message
I still cant get it right, in query.php i have this piece of code; echo "<form action='test2.php' action='post'> <select name='language'> <option value='0'selected='yes'>one</option> <option value='1'>two</option> </select> <input type=text name=query> <input type=submit name=submit> </form>"; and in test2.php i have this; if ($_POST['language'] = 1) {$lang = "EngP=1";} else {$lang = "EngP=0";} echo $lang ; But it always echoes EngP=1 no matter what I choose, what is wrong here?? "Erik Price" <pricee@hhbrown.com> wrote in message news:424D1EBF-893A-11D6-9500-0050E4857868@hhbrown.com... > > On Wednesday, June 26, 2002, at 02:51 PM, Haddad Said wrote: > > > Hi, i am having a problem passing variables from a drop down menu in a > > form; > > > > <from action=test.php action=post> > > <select name=example> > > <option selected> one</option> > > <option> two</option> > > </form> > > You should do it like this (be sure to properly quote your attributes, > and use the 'value' attribute of the 'option' tag): > > print "<form action='test.php' method='post'> > <select name='example'> > <option selected='yes' value='1'>One</option> > <option value='2'>Two</option> > </select> > </form>\n"; > > In the "test.php" page, the selected value will be found in the > $_POST['example'] variable. > > > Erik > > > > > > ---- > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > pricee@hhbrown.com >

« previous php.general (#104175) next »