473,395 Members | 1,530 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,395 software developers and data experts.

help pls..how to clear a url query string

hi guys,

my url is in this form: http://www.mysite.com?user=zen

what to do to remove the query string (..?user=zen) and make my url to
this form: http://www.mysite.com

tnx

Apr 24 '07 #1
5 9356
"shotokan99" <so**********@yahoo.comwrote in message
news:11**********************@t39g2000prd.googlegr oups.com...
hi guys,

my url is in this form: http://www.mysite.com?user=zen

what to do to remove the query string (..?user=zen) and make my url to
this form: http://www.mysite.com

$url = 'http://www.mysite.com?user=zen';
list($shorturl) = explode('?', $url);
echo $shorturl;

--
Ra*********@gmail.com

"Good tea. Nice house." -- Worf
Apr 24 '07 #2
Rami Elomaa napisał(a):
"shotokan99" <so**********@yahoo.comwrote in message
news:11**********************@t39g2000prd.googlegr oups.com...
>hi guys,

my url is in this form: http://www.mysite.com?user=zen

what to do to remove the query string (..?user=zen) and make my url to
this form: http://www.mysite.com


$url = 'http://www.mysite.com?user=zen';
list($shorturl) = explode('?', $url);
echo $shorturl;
there is a shorter way:
echo strtok($url,'?');

;)

--
Wiktor Walc
http://phpfreelancer.net
Apr 24 '07 #3
On Apr 24, 5:08 am, shotokan99 <soft_devj...@yahoo.comwrote:
hi guys,

my url is in this form: http://www.mysite.com?user=zen

what to do to remove the query string (..?user=zen) and make my url to
this form:http://www.mysite.com

tnx
$parts = parse_url('http://www.mysite.com?user=zen');
$url = $parts['scheme'] . '://' . $parts['host'];

Apr 24 '07 #4
tnx...it did the trick ;-)

Apr 25 '07 #5
C.
On 24 Apr, 10:22, "Rami Elomaa" <rami.elo...@gmail.comwrote:
"shotokan99" <soft_devj...@yahoo.comwrote in message

news:11**********************@t39g2000prd.googlegr oups.com...
hi guys,
my url is in this form: http://www.mysite.com?user=zen
what to do to remove the query string (..?user=zen) and make my url to
this form:http://www.mysite.com

$url = 'http://www.mysite.com?user=zen';
list($shorturl) = explode('?', $url);
echo $shorturl;

--
Rami.Elo...@gmail.com

"Good tea. Nice house." -- Worf

It's probably safer to use parse_url() see http://www.php.net/function.parse-url

C.

Apr 25 '07 #6

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

Similar topics

40
by: Peter Row | last post by:
Hi all, Here is my problem: I have a SQL Server 2000 DB with various NVarChar, NText fields in its tables. For some stupid reason the data was inserted into these fields in UTF8 encoding. ...
0
by: MNFV | last post by:
Hi, I've wrote the code GRAPHIC_ENGINE.ASPX.VB but it doesn't work properly, because the chart appears only with one dataline (the last line resulting from the query). Can anyone tell me what...
3
by: Tim::.. | last post by:
Can someone please help.... I'm having major issues with a user control I'm tring to create! I an trying to execute a sub called UploadData() from a user control which I managed to do but for...
7
by: Aaron | last post by:
Complete code follows. I am new to .NET programming (and programming in general) and I am having a difficult time understanding how to fill a variable in one sub, and then access it from...
8
by: pamelafluente | last post by:
I am beginning aspNet, I know well win apps. Need a simple and schematic code example to start work. This is what I need to accomplish: ---------------------- Given button and a TextBox on a...
6
by: ccsoupy22 | last post by:
For simplicity sake, here are the basics of the query I am stumped on... Type: Select query Name: ColorCells Below is a partial list of the "Cases" for the code (I did not think there was...
9
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result...
7
helpwithcode
by: helpwithcode | last post by:
Hi people, I am just learning java.I have been creating a project which involves JDBC Connectivity.I find that the statements, String string_dob=text_dob.getText(); //Converting string to...
5
by: kanley | last post by:
I have a main table with a text description field. In this field, its populated with a string of data. I need to identify from this string of data the name of the vendor using some keywords. I...
6
by: zaina | last post by:
hi everybody i am nwebie in this forum but i think it is useful for me and the member are helpful my project is about connecting client with the server to start exchanging messages between...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...

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.