Hi Everyone,
Issue: PHP Post variables are empty after submit.
Details:
<?php
include("function.php");
echo $_POST['id1'];
echo $id1;
fnc1();
?>
function.php:
function fnc1() {
ID1=<?=$_POST['id1'];?>
<form method="post">
<input type="hidden" name="id1" value="login" />
<input type="submit" />
</form>
}
Steps taken to fix this issue (although unsuccessful)
A. 1. wrote the below code snippet to get php config: (Thanks to developers like you that posted in some forum)
<?php
phpinfo();
?>
2. register_globals is off
3. Both the variables _POST['variableName'] and $variableName seem to be empty.
B. Tried copying php.ini to public_html folder.
Additional Information: GET variables work and POST variables are empty.
Please advise.
PHP Post Variables are empty
Moderator: General Moderators
Re: PHP Post Variables are empty
turn on error reporting at the top, error_reporting(E_ALL);
and your form goes nowhere.
and your form goes nowhere.
Re: PHP Post Variables are empty
Code: Select all
<?php
include("function.php");
fnc1();
echo $_POST['id1'];
echo $id1;
?>Code: Select all
<?php
function fnc1() {
$id1 = $_POST['id1'];
return $id1;
}
?>-
arunkumarm
- Forum Newbie
- Posts: 2
- Joined: Fri Apr 03, 2009 1:22 pm
Re: PHP Post Variables are empty
Hey Guys...
Thank you very much for all the responses.
After setting error_reporting to all:
"Undefined index: id1 in function.php"
php_east - I thought i was including this file in original file so action wasnt required.
McInfo - isset is always returning false.
Im still confused.
Thank you very much for all the responses.
After setting error_reporting to all:
"Undefined index: id1 in function.php"
php_east - I thought i was including this file in original file so action wasnt required.
McInfo - isset is always returning false.
Im still confused.
- becky-atlanta
- Forum Commoner
- Posts: 74
- Joined: Thu Feb 26, 2009 6:26 pm
- Location: Atlanta, GA
Re: PHP Post Variables are empty
If you want to result to output to the same form, you need this action:
Code: Select all
action="<?php $PHP_SELF ?>"Re: PHP Post Variables are empty
Let's see the form -- sounds like id1 is missing.
arunkumarm wrote:Hey Guys...
Thank you very much for all the responses.
After setting error_reporting to all:
"Undefined index: id1 in function.php"
php_east - I thought i was including this file in original file so action wasnt required.
McInfo - isset is always returning false.
Im still confused.