如果标题函数中有多个错误,如何添加“&”符号

My situation: I'm making a PHP contact form and I want my contact form to show the specific input textareas that are empty.

For example, a person who uses my contact form had written a message and the subject line but not their email address and the reCAPTCHA is wrong. I want to show the person who uses it why the email couldn't be sent by specifically telling them what went wrong. I thought of using the $_GET method on the contact page.

For example: http://example.com/contact?email=empty&recaptcha=incorrect

My problem:

When I was creating the contact form, I noticed that I will always have the & sign in the header function of php. I want the header function in my process page to not include the & sign if there is one incorrect thing.

For example: http://example.com/contact?email=empty&

You would be better off building an array and then using http_build_query to put it into a query string for you. This has the neat effect of also escaping the necessary characters.