473,473 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

does PHP automatically run rawurldecode on any any URL to figure out what pass parameters to capture?

I noticed, to my surprise, that PHP was still able to figure that
"search" is suppose to be an array:

http://www.accumulist.com/index.php?...ds%5D=bluewall

I'm impressed with that. Till now I've used POST in my forms as the
method for doing search forms, but now I'm trying GET and everything is
working fine.

Do most browsers auto encode a form input when it is sent via a GET
method? Is the encoding standard? It does not break anywhere?

What is PHP doing that it is able to figure out that in the above URL
"search" should be an array variable in the $_GET array?

Jan 7 '06 #1
3 2053
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

lawrence k wrote:
Do most browsers auto encode a form input when it is sent via a GET
method? Is the encoding standard? It does not break anywhere?


Yes, most browsers do encode form data prior to submitting it. Yes, it is a
standard, as per RFC1738. No, it doesn't usually break.

However, you should be careful about echo()ing URLs with spaces or other
simbols in them, for example:

<?php
$escaped_term = rawurlencode($term);
echo "<a href='search.php?term=$escaped_term'>Repeat search</a>";
?>

In most other cases, you won't need to worry about URL encoding.

- --
- ----------------------------------
Iván Sánchez Ortega -i-punto-sanchez--arroba-mirame-punto-net

Un ordenador no es un televisor ni un microondas, es una herramienta
compleja.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDv6HB3jcQ2mg3Pc8RAhGRAJ0baLUwxzItmsycPRgaX6 eaOFqWTQCeIv0J
T/DIPOPuOpRLmDB2v4F+f0g=
=w86i
-----END PGP SIGNATURE-----
Jan 7 '06 #2
lawrence k wrote:
I noticed, to my surprise, that PHP was still able to figure that
"search" is suppose to be an array:

http://www.accumulist.com/index.php?...ds%5D=bluewall

I'm impressed with that. Till now I've used POST in my forms as the
method for doing search forms, but now I'm trying GET and everything is
working fine.


There might be a drawback if your get statements tend to get very long
(2k charachters):

http://support.microsoft.com/default...;EN-US;q208427
Jan 8 '06 #3

Iván Sánchez Ortega wrote:
However, you should be careful about echo()ing URLs with spaces or other
simbols in them, for example:

<?php
$escaped_term = rawurlencode($term);
echo "<a href='search.php?term=$escaped_term'>Repeat search</a>";
?>

In most other cases, you won't need to worry about URL encoding.


I think you mean, if I understand you right, that I need to use
rawurlencode if I'm going to use a url in an echo statement, but most
of the rest of the time, away from echo statements, I do not have to
sweat much about rawurlencoding, because browsers do so much encoding
automatically?

Jan 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: paul b | last post by:
Hello, I have a small problem in PHP an perhaps someone can help me: I have a simple HTML login page with a username and a password field, as well as a submit button, which I have to use for...
4
by: swayze | last post by:
Hi, I'm sending some vars to php from javascript. These vars contain special chars (like "&" ,",")and also turkish characters. Therefore I'm using javascripts escape() function to be able to...
1
by: Hardy Wang | last post by:
Hi, I am wandering is it possible to capture all values posted (Http Post) from a web site to a web service? I would like to do something like following in web form: HttpContext ctx =...
13
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
1
by: Henry | last post by:
I hope someone can help me on this. I have two controls on a form. the first is a comboBox the second is a datagrid. Both controls are bound to tables in a common dataset. What I am trying to...
14
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
2
by: Extremest | last post by:
Here is the code I have so far. It connects to a db and grabs headers. It then sorts them into groups and then puts all the complete ones into another table. Problem I am having is that for some...
4
by: Jm lists | last post by:
Hello members, I want to know does the "eval" in python have the same features as in Perl (capture errors)? For example,in perl I can wrote: $re = eval { 1 / 0 }; Though 1/0 is a fatal...
10
by: Pavel Shved | last post by:
Is there a program of wide use that automatically extracts template parameters requirements from source code of template functions? I mean the following: assume we have a template function that...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.