i have a php code like this
<html>
<body>
<center>
<FORM action="" method="post">
<input type="hidden" name="form_action" value="1">
<table border=1>
<tr><td>test post</td><td><input type="text" size="60" name="post" value="http://site.com/"></td></tr>
</table>
<br>
<INPUT class=submit type="submit" value="[SUBMIT]" name="Submit">
</FORM>
</center>
</body>
</html>
<?
if ($_POST['form_action']) {
print_r($_POST['post']);
}
?>
i want to print the form post when Some one press the submit button.Where is the problem?
The code could work.
This line will probably give an error when the form is not posted yet, but it is in the bottom, so the HTML form should be generated already.
You can change this to
That will correct the check.
After that, the form should work, but mind that the form will be generated again, on each request, and the actual output you
print_rd is at the bottom of the output. Because it is outside of the html body, it may be rendered at the bottom of the page or it may not be rendered at all.You should be able to see the output when you View Source the page.