I want to insert $_POST
value into the HTML form action. By using my code I got this error message: Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) ....
This is my sample code in my PHP
file:
print <<< HERE
<form action="../../path/to/file.php?id=<?php echo $_POST['mytext'];?>" method="POST">
// some stuff here ...
<input type="text" name="mytext" id="mytext" value="">
<input type="submit" value="Submit">
</form>
HERE;
What is wrong with my code?
You don't need to add
id
in the form actionInstead in the
file.php
you can make a variable and assign$_POST['mytext']
to that variable