Page 1 of 1

form isn't passing variable

Posted: Sun Nov 14, 2010 9:44 am
by someguyhere
Any idea why the data entered in the text area never ends up getting passed to the variable here?

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>

<?php
if (isset($_POST["field"])) {
echo $field;
?>
	<a href="<?php echo $_SERVER[PHP_SELF]; ?>"><p>Return</p></a>


</body>
</html>

<?php
die();
}

else

?>

	<form action="<?php echo $_SERVER[PHP_SELF]; ?>" method="post" >
	<textarea name="field" rows="10" cols="30" ></textarea>
	<input type="submit" value="Submit" />
	</form>
</body>
</html>

Re: form isn't passing variable

Posted: Sun Nov 14, 2010 2:56 pm
by cpetercarter
Replace

Code: Select all

echo $field;
with

Code: Select all

echo $_POST['field'];