Re: dropdown Newbie question

From: Date: Thu, 05 Sep 2002 12:49:28 +0000
Subject: Re: dropdown Newbie question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-115299@lists.php.net to get a copy of this message
method is an attribute of <form>, not sure about <input>. --- // Theme echo ' <form name="theme" action="options.php" target="right" class="menu" METHOD="POST"> &nbsp;&nbsp;<select name="theme">'; for($i=0;$i<sizeof($theme_name);$i++) { echo "<option value='".$i."'>".$theme_name[$i]."</option>\n"; } echo '</select>&nbsp;&nbsp;<input type=submit value=select>'; // or: echo '</select>&nbsp;&nbsp;<input type=submit value=select>'; $var_from_dropdown = $_POST['theme']; exec("echo $var_from_dropdown > /tmp/varfromdropdown"); --- Justin French on 05/09/02 10:42 PM, Mario Ohnewald (mario.ohnewald@gmx.de) wrote: > Hi, > I tried it but i wasnt luck: > > // Theme > echo ' > <form name="theme" action="options.php" target=right class=menu> > &nbsp;&nbsp;<select name="theme">'; > for($i=0;$i<sizeof($theme_name);$i++) > { > echo "<option > value='".$i."'>".$theme_name[$i]."</option>\n"; > } > > echo '</select>&nbsp;&nbsp;<input type=submit name=get value=select > METHOD=POST>'; > // or: > echo '</select>&nbsp;&nbsp;<input type=submit name=get value=select > METHOD="POST">'; > > $var_from_dropdown = $_POST['theme']; > exec("echo $var_from_dropdown > /tmp/varfromdropdown"); > > the exec line seems to works since it created the file. But it stays emty. > > Cheers, Matio > >> From: Scott Houseman [mailto:scotth@jamwarehouse.com] >> >> >> Hi there. >> >> The value from that dropdown will be returned to you in the variable >> >> $_POST OR $_GET, depending on which method you used to submit >> the form. >> >> Assuming you use POST, you can access the selected value like this: >> >> $var_from_dropdown = $_POST['theme']; >> >> Regards >> >> -|Scott >> >> >>> -----Original Message----- >>> From: Mario Ohnewald [mailto:mario.ohnewald@gmx.de] >>> Sent: Thursday, September 05, 2002 1:11 PM >>> To: php-general@lists.php.net >>> Subject: [PHP] dropdown Newbie question >>> >>> >>> Hello! >>> I am very new in php and i have a little dummy question ;D >>> I have a dropdown box with a entry in it called "Coctail Blue" >>> Now i want to put the selected string ("Coctail Blue" in this >>> case) in to a >>> variable when i press the button below. >>> options.php is the page it should go after. >>> >>> // ..SNIP ... >>> >>> // Start Dropdown >>> echo ' >>> <form name="theme" action="options.php" target=right >>> class=menu> >>> &nbsp;&nbsp;<select name="theme">'; >>> for($i=0;$i<sizeof($theme_name);$i++) >>> { >>> echo "<option >>> value='".$i."'>".$theme_name[$i]."</option>\n"; >>> } >>> //end dropdown >>> >>> // Button >>> echo '</select>&nbsp;&nbsp;<input type=submit name=get >> value=select>'; >>> >>> //doesnt work: >>> $var_from_dropdown = theme >>> >>> // ..SNIP ... >>> >>> >>> What did i do wrong? >>> >>> Thank you! >>> Mario >>> >>> >>> -- >

« previous php.general (#115299) next »