Is there any better way to achieve the same result, by using PHP externally instead of inside the actual HTML tag? This method works fine, but it seems a little inconvenient to place PHP tags inside HTML tags like this. Especially when you have to adjust multiple attributes when submit is clicked. Or worse, multiple attributes of multiple elements in the same form!
As an absolute PHP beginner I have no clue...
<form method="post" action="">
<input type="text" name="input" value="
if (isset ($_POST['submit']) ) {
$input = $_POST['input'];
echo $input;
}
" />
<input type="submit" name="submit" />
</form>
Please note: The script above may be faulty, because I wrote it directly into this forum post without testing it externally. I am merely trying to point out the idea of it: Adjusting the style, value or any other attribute using PHP only.