HomeMonday, July 6, 2015, 13:29:02
1

PHP Form Action Self Submit

Tuesday, February 10, 15, 14:10:17, 5 Months Ago Via wain, Hits: 1
PHP form action self submit tutorial, requirement(s): PHP server
index.php
Code:
<?php
if(isset($_POST['submit']))
{
$filed1 = $_POST['field1'];
echo $filed1 . " ";
echo $filed2;
}else{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="field1">
<input type="hidden" name="filed2" value="hidden value">
<input type="submit" name="submit" value="Submit Form">
</form>
<?php } ?>

Comments

jonix Thursday, June 27, 2013, 08:16:05

replace:

$filed1 = $_POST[\'field1\'];

with:

$filed1 = $_POST[\'field1\'];
$filed2 = $_POST[\'field2\'];

Sign In

About Author

wain

Date Registered: Sun, Feb 8, 15
Last Time Online: Mon, Jun 15, 15
So far has created 111 entries.
wain
This author has not yet filled in any details.