473,379 Members | 1,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

_Get problems with character # in url

123 100+
When I use below to get the varible from a url like
test.php?aaaa=abc#1$bbbb=try
Expand|Select|Wrap|Line Numbers
  1.  
  2. $aaaa=$_GET["aaaa"];
  3. $bbbb=$_GET["bbbb"];
  4.  
  5. echo "1 : " . $aaaa . "<br />";
  6. echo "2 : " . $bbbb . "<br />";
  7.  
result will be as below
1 : abc
2:

all variable after # will be ignore, how to fix it?
Mar 12 '10 #1

✓ answered by Atli

Hey.

The # char has a special meaning in an URL. If you want to use it, you need to urlencode the string. Try replacing the # char with "%23". That is the URL special character that represents the # char.

Also, if you plan on using "bbbb" in there as a variable, you need to seperate it from the "aaaa" value using a question mark "&", not a dollar sign "$".

1 2515
Atli
5,058 Expert 4TB
Hey.

The # char has a special meaning in an URL. If you want to use it, you need to urlencode the string. Try replacing the # char with "%23". That is the URL special character that represents the # char.

Also, if you plan on using "bbbb" in there as a variable, you need to seperate it from the "aaaa" value using a question mark "&", not a dollar sign "$".
Mar 12 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Daniel Doman | last post by:
I have a string that I $_get' from the query string lets say that it is "The Hallie's" The entire Query string looks like this: $_SERVER == op=The%20Hailie%27s (I edited out other...
5
by: gf | last post by:
I had a client recently contact me with a script that wasn't working. I quickly isolated the problem as to the fact that the $_GET array was not being made available to all scripts, even though...
32
by: Nuno Paquete | last post by:
Hi group. I'm using this code to see if is there any parameter for variable "menu": if($_GET == "downloads") .... But this code log errors if there is no parameter passed (this heappens at...
27
by: meltedown | last post by:
urlencode turns # into %23 When I sent it thru $_GET, it dissapears, along with anything that comes after it. for example: urlencode turns HOYDM_EXC_#4_NAT into HOYDM_EXC_%234_NAT When I...
3
by: stephane | last post by:
I have a file.php in which a created dynamic hypertext links and send a variable $row echo "<td><a href='modify_request.php?$row'>$row</a></td>"; I can see in the url on modify_request.php the...
5
by: chad.a.morris | last post by:
I don't have a lot of experience using $_GET. I need to know how to pass characters in using the $_GET method. The character I'm having a problem with right now is '#', but I'm sure there are...
6
by: gizz | last post by:
Hi, I'd like to know whether there is a limit in the number of characters of a $_GET parameter ? Thanks in advance !
2
by: keeps21 | last post by:
I have a script that recieves an id number via the address bar when a link is clicked. ie . index.php?id=1 if the link was for the story whose ID is 1. My script checks if a user is logged in,...
2
by: albert | last post by:
Hello, I'm generating an image with the GD lib. As I need to send parameters to the image, this is my code : <? $MyText = "this is my text" ; ?> <img src="MyImg.php?text=<?=$MyText ?>"...
17
by: sheldonlg | last post by:
I need to do some modifications on some code I just inherited and that code has me baffled. On one page, caller.php, with method get there is an anchor with href="foo.php?bar=123". On foo.php,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.