RE: Re: post and variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 "<p>The 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 "<p>The 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"" <ross@xxxxxxxxxxxxx> wrote in message 
> news:08.40.45231.35323734@xxxxxxxxxxxxxxx
> 
>>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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux