This article introduces how to use the get method when submitting a form. Then, we get garbled characters using get, let's take a look at how to solve this problem.
I was going to use it like this.
| The Code is as follows: |
Copy code |
<A href = "list. php? Plate = jurisdiction Dynamics "charset =" UTF-8 "target =" main "> [view jurisdiction dynamics] </a> |
The result is displayed on the list. php page: view [dynamic region of the jurisdiction].
I think the encoding of the Chinese character "state" may conflict with something, so...
I found this solution on the Internet:
Usage:
| The Code is as follows: |
Copy code |
<A href = "list. php? Plate = <? Php echo urlencode ("region Dynamics");?> "Charset =" UTF-8 "target =" main "> [view] </a> |
Use the following code on the list. php page:
| The Code is as follows: |
Copy code |
$ Plate = urldecode ($ _ GET ['plate ']); |
It won't be garbled and the transmission is not normal.
About the string urlencode (string $ str) Function
This function allows you to encode a string and use it in the URL request section. It also allows you to pass variables to the next page.
Example #1 urlencode () Example
| The Code is as follows: |
Copy code |
<? Php Echo '<a href = "mycgi? Foo = ', urlencode ($ userinput),' "> '; ?> |
Example #2 Examples of urlencode () and htmlentities ()
| The Code is as follows: |
Copy code |
<? Php $ Query_string = 'foo = '. urlencode ($ foo).' & bar = '. urlencode ($ bar ); Echo '<a href = "mycgi? '. Htmlentities ($ query_string).' "> '; ?> |