/    Sign up×
Community /Pin to ProfileBookmark

Str Replace Problem in echo

How do I do more than one str in one echo for a form field.

I have a drow list of “departments” the value is the main contact’s email in that department, when they hit submit, I don’t want them to see the email address, I want the Department displayed back to them. This script below works fine for me, but its only 1 option, How do I do a more than one email/department str replace?

[code=php]<? $Field = str_replace(“email@address”, “Department”, $Field); echo “$Field”; ?>[/code]

Example:

email1@address [replaced with] Department1
email2@address [replaced with] Department2
email3@address [replaced with] Department3

Thank you.

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@d_brandusaauthorApr 13.2004 — Sorry..I'm a dumbass, I figured it out.

[code=php]<? $Field = str_replace("email1@address", "Department1", $Field); $Field = str_replace("email2@address", "Department2", $Field); echo "$Field"; ?>[/code]
×

Success!

Help @d_brandusa spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.10,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...