[PHP] Re: post and variables
Sorry I got confused. I am using variable variables. Disregard. Ross [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks fpr all the feedback on the password but I have another one... How do I use $_POST with variables. Cant find an example of this anywhere on php.net if ($_POST['$table_name== 1']) { //do something } Ta, ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: post and variables
Ross wrote: Sorry I got confused. I am using variable variables. Disregard. Ross [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks fpr all the feedback on the password but I have another one... How do I use $_POST with variables. Cant find an example of this anywhere on php.net if ($_POST['$table_name== 1']) { $tablename = 'yourtable'; if (isset($_POST[ $tablename ]) $_POST[ $tablename ] == 1) { echo $tablename, ' has been selected'; } //do something } Ta, ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: post and variables
Essentially, Ross, you can use $_POST variables as a regular associative array. $_POST values come from the posted values in a form. If you have a form element called table_name, and your form uses the post method (as opposed to the get method), your script would have $_POST['table_name'] available to it. As the example below shows, you can then check its value. The value of $_POST['table_name'] is the value that was entered in the corresponding form element. In this case, you're looking to see if it's equal to 1. If you want to output the value of a $_POST variable, you could do something like echo pThe value of table_name is {$_POST['table_name']}/p\n; or if you don't have a free flowing input box you would probably want to output the value with htmlentities or htmlspecialchars. echo pThe value of table_name is . htmlentities($_POST['table_name']) . /p\n; I hope this helps. The previous posters are right though, there is lots of documentation out there Robbert Ross wrote: Sorry I got confused. I am using variable variables. Disregard. Ross [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Thanks fpr all the feedback on the password but I have another one... How do I use $_POST with variables. Cant find an example of this anywhere on php.net if ($_POST['$table_name== 1']) { $tablename = 'yourtable'; if (isset($_POST[ $tablename ]) $_POST[ $tablename ] == 1) { echo $tablename, ' has been selected'; } //do something } Ta, ross -- 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
[PHP] Re: POST form variables not being sent to destination page
On the PHP Bug board, I managed to find that it was to do with the Apache configuration settings, namely, you should put AddType application/x-httpd-php .php .php3 instead of; FilesMatch \.php$ SetOutputFilter PHP /FilesMatch in the httpd.conf file. This took ages to find and was only posted within that last few days on the PHP bug board, hope it helps you with your elusive first POST variable. Whow, thanks man. It works like a webserver should work. All my problems are gone, even the huge POST problem I've had (bug #19263). Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: POST form variables not being sent to destination page
Hi there, I don't really see any "serious" problem in your code except that your opening body tag is in the wrong place :). Since I don't have php/apache running on my XP I cannot really tell if this is an installation problem. Anyway, I have php/apache (4.2.2/1.3.26) on Linux and (4.2.2/2.0.40) on Windows 2000 Pro. Your code works whether it's GET or POST. So, one thing that you might want to try is to install the latest version of PHP. Esp., as the php.net site says that the latest version (4.2.3) is "recommended update for all users of PHP, and Windows users in particular ". Also, you may want to check previous posts regarding 4.2.2/2.0.40 combination--doesn't look so stable on XP(?)... - E "Howard Roscoe" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I'm assuming this is an installation error, hence the posting to this group. I've got an html form but when I use the POST method the form variables don't make it to the destination page, when I use the GET method, there's no problem. I've uploaded the test pages to our web servers and the POST and GET methods both work fine, therefore I'm assuming it's a problem with my installation, which is; PHP 4.2.2 Apache 2.0.40 on Windows XP Pro with as many MS patches as I can find !!. I've tried this with and without the register_globals, I've also tried setting the "always_populate_raw_post_data" to on by way of a stab in the dark. The only thing I can think of is something to do with the Apache configuration, but I can't find anythnin in there re this. The test PHP is; Form Page: html head titleUntitled Document/title meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /head form action="b.php" method=post name="bb" input name="aa" type="text" value="12" size="10"br input name="a1" type="submit" /form body /body /html Target Page: html head titleUntitled Document/title meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /head ?php echo "POSTED :".$_POST["aa"]."br"; echo "GET :".$_GET["aa"]."br"; ? body /body /html Any help / pointers will be much appreciated as this is starting to drive me nuts. Thanks, Howard -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: POST form variables not being sent to destination page
I've got an html form but when I use the POST method the form variables don't make it to the destination page, when I use the GET method, there's no problem. I've uploaded the test pages to our web servers and the POST and GET methods both work fine, therefore I'm assuming it's a problem with my installation, which is; The test PHP is; Form Page: html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859- 1 /head form action=b.php method=post name=bb input name=aa type=text value=12 size=10br input name=a1 type=submit /form body Try adding another input name...etc. We've had a problem where we *always* lost the first POST variable. Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: POST form variables not being sent to destination page
Hi Erwin, Thanks for the reply but it turned out to be a slightly odd installation bug. On the PHP Bug board, I managed to find that it was to do with the Apache configuration settings, namely, you should put AddType application/x-httpd-php .php .php3 instead of; FilesMatch \.php$ SetOutputFilter PHP /FilesMatch in the httpd.conf file. This took ages to find and was only posted within that last few days on the PHP bug board, hope it helps you with your elusive first POST variable. Thanks for you help though, Regards Howard Erwin [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I've got an html form but when I use the POST method the form variables don't make it to the destination page, when I use the GET method, there's no problem. I've uploaded the test pages to our web servers and the POST and GET methods both work fine, therefore I'm assuming it's a problem with my installation, which is; The test PHP is; Form Page: html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859- 1 /head form action=b.php method=post name=bb input name=aa type=text value=12 size=10br input name=a1 type=submit /form body Try adding another input name...etc. We've had a problem where we *always* lost the first POST variable. Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php