Forum Moderators: coopster
here is my code
--- TEST.PHP
<?php
session_start();
ob_start();
?>
<html>
<head>
<title>hello World!</title>
</head><body>
<?php
if ($_POST["submit"])
{
if (trim($_POST['name']) == "")
$formMsg = "Name is needed!";
if ($formMsg == "" ){
emailUser($name);
header("Location: test.php");
}
}if ($_SESSION[sentOk]){
$formMsg = "Thank you for Submitting!";
unset($_SESSION[sentOk]);
}print "
<form action='$PHP_SELF' method='post'>
<div>
$formMsg
</div>
<div>
<label for='name'>
Name:
</label>
<span>
<input type='text' name='name' id='name' maxlength='20' tabindex='1' />
</span>
</div>
<div>
<label>
</label>
<input id='submit' name='submit' title='Submit' type='submit' value='Submit' tabindex='2'/>
</div>
</form>
";
?>
</body>
</html><?php
function emailUser($name){
//Hurray email was send oki-dokie...
$_SESSION[sentOk] = true;
return;
}
?>
[edited by: Cheetahten at 7:00 pm (utc) on Oct. 11, 2007]
I believe you aren't receiving the output because of your use of ob_start(). You either have to remove this, which it isn't really needed here, or you have to dump the contents of the buffer to the browser using ob_end_flush [us2.php.net].
If I were you, though, I would just remove it.