RE: [PHP] dropdown Newbie question
Hello, after a little break ( i really needed it ;P), i tried to get this thing wotkig again. I changed action to .$PHP_SELF. and i added the echo to test if it works: echo $_POST['test']; But still emtpy, what do i do wrong? ?php echo ' form name=test action='.$PHP_SELF.' method=POSTbr select id=colorPicker onChange=changeColor(this.options[this.selectedIndex].value) optionBackground Color option value=FFBlue option value=FFRed option value=00FF00Green option value=00Black /select input type=submit value=Click To View Submission /form '; echo $_POST['test']; ? /body /html From: Jay Blanchard [mailto:[EMAIL PROTECTED]] [snip] Did you put a closing form tag? /form you are right, the closeing tag was missing, well, it still doesnt work/stays emty ;/ [/snip] Does this form refer to itself, or another page? Also, like Justin said, echo the variable before writing to a directory to see what is getting written, if anything. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dropdown Newbie question
u cannot use form's name as variable . u should replace this row select id=colorPicker like this select name=test id=colorPicker u can see the selected option's value -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dropdown Newbie question
Hi Mario, you can set error_reporting to E_ALL to give you more hints to bugs and to produce clean code. You are having two problems. The first was related to your form and has been addressed by Yasin. The second is that you have autoglobals off. That means you have to use $_SERVER['PHP_SELF']. BTW: You could have found this error by reading about predefined variables, PHP_SELF in the manual. Timo Working: ?php echo ' form name=test action='.$_SERVER['PHP_SELF'].' method=POSTbr select name=color id=colorPicker onChange=changeColor(this.options[this.selectedIndex].value) optionBackground Color option value=FFBlue option value=FFRed option value=00FF00Green option value=00Black /select input type=submit value=Click To View Submission /form '; if(isset($_POST['color'])) {echo $_POST['color'];} ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dropdown Newbie question
Hi Mario, you can set error_reporting to E_ALL to give you more hints to bugs and to produce clean code. You are having two problems. The first was related to your form and has been addressed by Yasin. The second is that you have autoglobals off. That means you have to use $_SERVER['PHP_SELF']. BTW: You could have found this error by reading about predefined variables, PHP_SELF in the manual. Timo Working: ?php echo ' form name=test action='.$_SERVER['PHP_SELF'].' method=POSTbr select name=color id=colorPicker onChange=changeColor(this.options[this.selectedIndex].value) optionBackground Color option value=FFBlue option value=FFRed option value=00FF00Green option value=00Black /select input type=submit value=Click To View Submission /form '; if(isset($_POST['color'])) {echo $_POST['color'];} ? /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dropdown Newbie question
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:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:11 PM To: [EMAIL PROTECTED] 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;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } //end dropdown // Button echo '/selectnbsp;nbsp;input type=submit name=get value=select'; //doesnt work: $var_from_dropdown = theme // ..SNIP ... What did i do wrong? Thank you! Mario -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dropdown Newbie question
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey, If your php version is = 4.1.0 use: $var_from_dropdown = $_GET['theme']; else use: $var_from_dropdown = $HTTP_GET_VARS['theme']; You might want to change the method used to submit your form from get to post, like: // Start Dropdown echo 'form name=theme action=options.php method=post target=right class=menu Then you code should read: $var_from_dropdown = $_POST['theme']; or $var_from_dropdown = $HTTP_POST_VARS['theme']; applying the rules from above. Hope that helps! ~Pauly On Thursday 05 September 2002 07:18 am, Scott Houseman wrote: 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:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:11 PM To: [EMAIL PROTECTED] 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;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } //end dropdown // Button echo '/selectnbsp;nbsp;input type=submit name=get value=select'; //doesnt work: $var_from_dropdown = theme // ..SNIP ... What did i do wrong? Thank you! Mario -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - -- ~Paul Nicholson Design Specialist @ WebPower Design The webthe way you want it! [EMAIL PROTECTED] It said uses Windows 98 or better, so I loaded Linux! Registered Linux User #183202 using Register Linux System # 81891 -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE9d0OmDyXNIUN3+UQRAmbzAJ9qUW6LYEndO81ybqFsMpeklHzs1wCfUGDK Egom83QUipWIZ0ko2q1x5/s= =OiSG -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dropdown Newbie question
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;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } echo '/selectnbsp;nbsp;input type=submit name=get value=select METHOD=POST'; // or: echo '/selectnbsp;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:[EMAIL PROTECTED]] 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:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:11 PM To: [EMAIL PROTECTED] 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;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } //end dropdown // Button echo '/selectnbsp;nbsp;input type=submit name=get value=select'; //doesnt work: $var_from_dropdown = theme // ..SNIP ... What did i do wrong? Thank you! Mario -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dropdown Newbie question
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;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } echo '/selectnbsp;nbsp;input type=submit value=select'; // or: echo '/selectnbsp;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 ([EMAIL PROTECTED]) 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;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } echo '/selectnbsp;nbsp;input type=submit name=get value=select METHOD=POST'; // or: echo '/selectnbsp;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:[EMAIL PROTECTED]] 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:[EMAIL PROTECTED]] Sent: Thursday, September 05, 2002 1:11 PM To: [EMAIL PROTECTED] 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;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } //end dropdown // Button echo '/selectnbsp;nbsp;input type=submit name=get value=select'; //doesnt work: $var_from_dropdown = theme // ..SNIP ... What did i do wrong? Thank you! Mario -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dropdown Newbie question
[snip] // Theme echo ' form name=theme action=options.php target=right class=menu nbsp;nbsp;select name=theme'; for($i=0;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } echo '/selectnbsp;nbsp;input type=submit name=get value=select METHOD=POST'; // or: echo '/selectnbsp;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. [/snip] You need to place METHOD=POST in the original form tag and remove it from the submit tag. Try that HTH! Jay * * Texas PHP Developers Conf Spring 2003* * T Bar M Resort Conference Center* * New Braunfels, Texas * * Contact [EMAIL PROTECTED] * * * * Want to present a paper or workshop? Contact now! * * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dropdown Newbie question
Well, this is my original Code: -- // Theme echo ' form name=theme action=options.php target=right class=menu METHOD=POST nbsp;nbsp;select name=theme'; for($i=0;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } echo '/selectnbsp;nbsp;input type=submit name=get value=select'; $var_from_dropdown = $_POST['theme']; exec(echo $var_from_dropdown /tmp/varfromdropdown); The file /tmp/varfromdropdown is still emty. (the dropdown field is NOT emty by the time i press the select button) Any other ideas? From: Jay Blanchard [mailto:[EMAIL PROTECTED]] [snip] // Theme echo ' form name=theme action=options.php target=right class=menu nbsp;nbsp;select name=theme'; for($i=0;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } echo '/selectnbsp;nbsp;input type=submit name=get value=select METHOD=POST'; // or: echo '/selectnbsp;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. [/snip] You need to place METHOD=POST in the original form tag and remove it from the submit tag. Try that HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dropdown Newbie question
[snip] Well, this is my original Code: // Theme echo ' form name=theme action=options.php target=right class=menu METHOD=POST nbsp;nbsp;select name=theme'; for($i=0;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } echo '/selectnbsp;nbsp;input type=submit name=get value=select'; $var_from_dropdown = $_POST['theme']; exec(echo $var_from_dropdown /tmp/varfromdropdown); The file /tmp/varfromdropdown is still emty. (the dropdown field is NOT emty by the time i press the select button) Any other ideas? [/snip] Did you put a closing form tag? /form Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dropdown Newbie question
Why don't you take the guesswork out of it a bit, and NOT write to a file just yet... instead, just echo the var to the screen. IF that works, then we know it's not your form that is the problem, it's the exec(). Justin on 06/09/02 12:08 AM, Mario Ohnewald ([EMAIL PROTECTED]) wrote: Well, this is my original Code: -- // Theme echo ' form name=theme action=options.php target=right class=menu METHOD=POST nbsp;nbsp;select name=theme'; for($i=0;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } echo '/selectnbsp;nbsp;input type=submit name=get value=select'; $var_from_dropdown = $_POST['theme']; exec(echo $var_from_dropdown /tmp/varfromdropdown); The file /tmp/varfromdropdown is still emty. (the dropdown field is NOT emty by the time i press the select button) Any other ideas? From: Jay Blanchard [mailto:[EMAIL PROTECTED]] [snip] // Theme echo ' form name=theme action=options.php target=right class=menu nbsp;nbsp;select name=theme'; for($i=0;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } echo '/selectnbsp;nbsp;input type=submit name=get value=select METHOD=POST'; // or: echo '/selectnbsp;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. [/snip] You need to place METHOD=POST in the original form tag and remove it from the submit tag. Try that HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dropdown Newbie question
From: Jay Blanchard [mailto:[EMAIL PROTECTED]] Did you put a closing form tag? /form you are right, the closeing tag was missing, well, it still doesnt work/stays emty ;/ // Theme echo ' form name=theme action=options.php target=right class=menu method=POST nbsp;nbsp;select name=theme'; for($i=0;$isizeof($theme_name);$i++) { echo option value='.$i.'.$theme_name[$i]./option\n; } echo '/selectnbsp;nbsp;input type=submit name=get value=select'; echo '/form'; //i tried it here $var_from_dropdown = $_POST['theme']; exec(echo $var_from_dropdown /tmp/varfromdropdown); //echo '/form'; //and here, to be sure. Of course never toghether! Mario Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] dropdown Newbie question
[snip] Did you put a closing form tag? /form you are right, the closeing tag was missing, well, it still doesnt work/stays emty ;/ [/snip] Does this form refer to itself, or another page? Also, like Justin said, echo the variable before writing to a directory to see what is getting written, if anything. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php