Sounds like you're on a bad host, hearing all of the problems that you've had with PHP.
Printable View
Sounds like you're on a bad host, hearing all of the problems that you've had with PHP.
Try that. Does it refresh now. And what do you mean the page refreshes? Like when you load it it refreshes? Or what...?PHP Code:<?php
if(isset($_POST['name'])){
echo("hi ".$_POST['name']."");
} else {
echo ("
<form method=\"post\" enctype=\"text/plain\" action=\"$_SERVER['PHP_SELF']\">
Name: <input type=\"text\" name=\"name\"> <br />
<input type=\"submit\" value=\"Submit\" name=\"submit\">
</form>
");
?>
That is useless, horrible code.
Fine I will do it for you.
PHP Code:<?php
if( empty( $_POST[ 'name' ] ) === false ) {
echo 'Hi, ' . $_POST[ 'name' ];
} else {
echo <<<HTML
<form action="" method="post">
Name: <input type="text" name="name" /> <br />
<input type="submit" value="Submit" name="submit" />
</form>
HTML;
}
?>
I have been trying to figure this out but I can't...
Why on earth does pressing the Submit button just clear the boxes/refresh the page? Could it be that I messed up the action="" value?
No, I thought you didn't need it if it's on the same page. I've also tried echo '<form action="'.$HTTP_SERVER_VARS['PHP_SELF'].'"; and so on but same problem.
internet