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

string replace

hi all i need to replace a space in a string of code... basically when
it creates this link it calls up the state name Like "New Mexico", how
would i replace the space in New Mexico making it newmexico. my code
is below.

<a href="<?php echo(urlencode($_GET['state2']));?>/<?php
echo(urlencode($_GET['city2']));?>main.php?state2=<?php
echo(urlencode($_GET['state2']));?>&city2=<?php
echo(urlencode($_GET['city2']));?>"></a>
Jul 17 '05 #1
4 5637
On Mon, 16 Aug 2004 09:10:40 -0700, Mikey P wrote:
hi all i need to replace a space in a string of code... basically when
it creates this link it calls up the state name Like "New Mexico", how
would i replace the space in New Mexico making it newmexico. my code
is below.

<a href="<?php echo(urlencode($_GET['state2']));?>/<?php
echo(urlencode($_GET['city2']));?>main.php?state2=<?php
echo(urlencode($_GET['state2']));?>&city2=<?php
echo(urlencode($_GET['city2']));?>"></a>

$foo = str_replace(' ', '', $foo);
Please read php.net before asking the most basic of questions _easily_
answered with a bit of 'S E L F I N I T I T A V E!'.

You'll be wanting to be spoon fed next [sigh].

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #2
On 16 Aug 2004 09:10:40 -0700, Mikey P <ph*********@comcast.net> wrote:
hi all i need to replace a space in a string of code... basically when
it creates this link it calls up the state name Like "New Mexico", how
would i replace the space in New Mexico making it newmexico. my code
is below.

<a href="<?php echo(urlencode($_GET['state2']));?>/<?php
echo(urlencode($_GET['city2']));?>main.php?state2=<?php
echo(urlencode($_GET['state2']));?>&city2=<?php
echo(urlencode($_GET['city2']));?>"></a>


Don't know which variable you need to strip the space from but for startes
have a look at:
http://www.php.net/str_replace

--
Jari Lehtinen
http://www.jarilehtinen.net
Jul 17 '05 #3
"Ian.H" <ia*@WINDOZEdigiserv.net> wrote in message
news:pa****************************@bubbleboy.digi serv.net...
On Mon, 16 Aug 2004 09:10:40 -0700, Mikey P wrote:
hi all i need to replace a space in a string of code... basically when
it creates this link it calls up the state name Like "New Mexico", how
would i replace the space in New Mexico making it newmexico. my code
is below.

<a href="<?php echo(urlencode($_GET['state2']));?>/<?php
echo(urlencode($_GET['city2']));?>main.php?state2=<?php
echo(urlencode($_GET['state2']));?>&city2=<?php
echo(urlencode($_GET['city2']));?>"></a>

$foo = str_replace(' ', '', $foo);
Please read php.net before asking the most basic of questions _easily_
answered with a bit of 'S E L F I N I T I T A V E!'.

You'll be wanting to be spoon fed next [sigh].


I'm trying to declare a variable named 'foo'. Can anyone help me?
Jul 17 '05 #4
.oO(Chung Leong)
I'm trying to declare a variable named 'foo'. Can anyone help me?


class TVar {
static function create($name) {
$GLOBALS[$name] = '';
}
}

TVar::create('foo');

SCNR
Micha
Jul 17 '05 #5

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

Similar topics

4
by: higabe | last post by:
Three questions 1) I have a string function that works perfectly but according to W3C.org web site is syntactically flawed because it contains the characters </ in sequence. So how am I...
13
by: M | last post by:
Hi, I've searched through the previous posts and there seems to be a few examples of search and replacing all occurrances of a string with another string. I would have thought that the code...
13
by: dimitris67 | last post by:
How can I replace an occurence of p(a string) in an other string(s) with np(new string).. char* replace _pattern(char *s,char *p,char *np) PLEASE HELP ME!!!!!
7
by: VMI | last post by:
If I have the string "Héllo", how can I replace char (é) with an 'e'? I cannot use the String.Replace() fuction. It has to be by replacing one char with another. Thanks.
32
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
12
by: Jeff S | last post by:
In a VB.NET code behind module, I build a string for a link that points to a JavaScript function. The two lines of code below show what is relevant. PopupLink = "javascript:PopUpWindow(" &...
9
by: Crirus | last post by:
dim pp as string pp="{X=356, Y=256}{X=356, Y=311.2285}{X=311.2285, Y=356}{X=256, Y=356}{X=200.7715, Y=356}{X=156, Y=311.2285}{X=156, Y=256}{X=156, Y=200.7715}{X=200.7715, Y=156}{X=256,...
9
by: Peter Row | last post by:
Hi, I know this has been asked before, but reading the threads it is still not entirely clear. Deciding which .Replace( ) to use when. Typically if I create a string in a loop I always use a...
15
by: morleyc | last post by:
Hi, i would like to remove a number of characters from my string (\t \r \n which are throughout the string), i know regex can do this but i have no idea how. Any pointers much appreciated. Chris
3
by: kronus | last post by:
I'm receiving an xml file that has a child called modified and it represents a date value in the form of a string -- Nov 14, 2008 -- and in my app, I have items associated with each object and I'm...
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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:
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.