PHP:如果action已包含GET值,如何使用方法GET

I have a form, something like this:

<form action='index.php?page=search&filter=1'>
<input type='text' name='ID'>
<input type='text' name='number'>
<input type='submit'>
</form>

If I submit form, it will go to page:

index.php?ID=value1&number=value2

I would like to have

index.php?page=search&filter=1&ID=value1&number=value2

How can I append extra fields to url ?

Thank you for help.

you should put these values in hidden inputs:

<form action='index.php'>
<input type='hidden' name='page' value='search'>
<input type='hidden' name='filter' value='1'>

<input type='text' name='ID'>
<input type='text' name='number'>
<input type='submit'>
</form>

Use hidden fields with your form and you will get exact url you want.

Try below code :

<form action="index.php" method="get">
<input type='hidden' name='page' value='search'>
<input type='hidden' name='filter' value='1'>

<input type='text' name='ID'>
<input type='text' name='number'>
<input type='submit'>
</form>

You can submit additional GET value as a hidden field value in the form which will be submit along with form submission.

<form action="index.php" method="get">
<input type='text' name='ID'>
<input type='text' name='number'>
<input type='hidden' name='page' value='search'>
<input type='hidden' name='filter' value='1'>
<input type='submit'>
</form>

Try using some hidden input fields and use get method in form submitting. Try this:

<form action="index.php" method="GET">
<input type='hidden' name='page' value='search' />
<input type='hidden' name='filter' value='1' />
<input type='text' name='ID' value='value1' />
<input type='text' name='number' value='value2' />
<input type='submit' value='Submit' />
</form>