Can't echo Please help
Posted: Sun Jun 26, 2011 7:03 am
i got the following code:
When i'm submitting this i get back no values, Why?
I am trying to understeand something so this is why i created this

Code: Select all
<?php
class Test
{
public $_text;
public $_submit;
public function __construct()
{
$this->_submit = isset($_POST['submit'])? 1 : 0;
$this->_text = ($this->_submit)? ($_POST['text']) : $_text;
}
public function registervalues()
{
$_text = $this->_text;
}
public function action()
{
echo $_text;
}
}
if(isset($_POST['submit']))
{
$test = new Test();
$test->registervalues();
$test->action();
}
?>
<form action='<?php echo $_SERVER['PHP_SELF']; ?>' method='POST'>
<input type='text' name='text'><br>
<input type='submit' value='submit' name='submit'>
</form>I am trying to understeand something so this is why i created this