I have one variable already set (received through GET, too). I want to pass it, together with the variables of the form. The problem is that the new page takes only the variable from the from.
This is the code:

$insertion_type=$_GET['insertion_type'];
echo "<form action='index.php?insertion_type=".$insertion_type."&' method='get'>";
echo "Number of registrations<br /><input type='text' name='insertion_count'><br />";
echo "<input type='submit' value='Submit'>";
echo "</form>";

I am expecting to get this url after the submit:
index.php?insertion_type=somenumber&insertion_count=somenumber
but I get in place
index.php?insertion_count=somenumber

Please help. Thank you.

replace line 2

echo "<form action='index.php?insertion_type=".$insertion_type."&' method='get'>";

for this

echo "<form action=\"index.php?insertion_type=".$insertion_type."&\" method=\"get\">";

thank you. but I don't know why, it still works the same way, not passing insertion type after the subimt

I know this is an old thread but comes up on google, so here's the solution:

You can't have GET variables in both the action URL and in a form, so just move the action's get variables into the form using a hidden inputs. In this case replace second line with these two:

echo "<form action='index.php' method='get'>";
echo "<input type='hidden' name='insertion_type' value='" . $insertion_type . "'/>";
commented: one of the few necroposters to make a positive contribution +15