Re: Empty $_POST after submit.

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

 



I took your script and added some stuff. Call it "testisset.php", upload it and try to run it.

Script below - Please copy and run it EXACTLY as written:

<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', '1');
$errmsg = "POST is:<br>";
foreach($_POST as $k=>$v)
	$errmsg .= "$k is $v<br>";
if (isset($_POST['submit']))
{
	if (isset($_POST['lastname'], $_POST['lastname']))
	{
		echo "isset is true<br>";
		echo "Entered values are:<br>";
echo("First name: '" . $_POST['firstname']."' - " . strlen($_POST['firstname'])." chars long<br />"); echo("Last name: '" . $_POST['lastname']."' - " . strlen($_POST['lastname'])." chars long <br />");
		echo $errmsg;
	}
}
else
{
	$code=<<<heredocs
	<html>
	<head>
	</head>
	<body onload="document.thisform.firstname.focus()">
	Data Entry Form:<br>
	<form name="thisform" action="testisset.php" method="post">
	  First name: <input type="text" tabindex=1 name="firstname" /><br>
	  Last name: <input type="text" tabindex=2 name="lastname" /><br>
	  <input type="submit" name="submit" tabindex=3 value="Submit" />
	</form>
	$errmsg
	</body>
	</html>
heredocs;
	echo $code;
}
exit();

***********
On the initial execution you should see your input form and the POST values will be missing (no vars at all).

Once you enter anything and hit "Submit" your will see your top two displays followed by the contents of the POST array which should show something at that time. If not - you have a configuration problem.

Note: While I questioned your isset test method (testing the same var twice?), I used it in this script just as you did.


--
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