Skip to content Skip to sidebar Skip to footer

Html Forms In Php

i am writing html form code with in php script here it is

Solution 1:

If a form is method="GET" (which is the default), as this one is, then submitting it will erase the existing query string in the action.

Store the data in a hidden input instead.

<?php$problem_code="STR";
?><formname="submit-button"action="/codejudge/submit.php"><inputtype="hidden"name="id"value="<?phpecho htmlspecialchars($problem_code); ?>"><buttontype="submit">Submit</button></form>

Solution 2:

You should specify a method of form submit.

$problem_code="STR";
echo'<form method=post name="submit-button" action="/codejudge/submit.php?id='.$problem_code.'">';
echo'<button type="submit" >Submit</button>';
echo"</form>";

Post a Comment for "Html Forms In Php"