close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

str_replace names in code

Thread began 3/23/2011 3:45 pm by tone397472 | Last modified 4/12/2011 9:12 am by tone397472 | 1451 views | 7 replies |

tone397472

str_replace names in code

Hi,

I received the code to change one name in the Blank.php email:

<?php echo(str_replace( "naam2", "naam", str_replace...etc.

But how do I change 5 different names? Can you please show me the code for that?!

Thanks a lot! David

Sign in to reply to this post

Jason ByrnesWebAssist

can you give a little more detail on what you are trying to change?

are you trying to change the way the labels show in the email? taken from the form element names?

Sign in to reply to this post

tone397472

Hi Jason,

Because I used a second instance of Universal Email on one web page I have to change some input names from a form. For example name2 in name.

The code I have in Blank.php works, but is only for one name.
<?php echo(str_replace( "name2", "name", str_replace... etc. How do I add more items to this line of code to replace?!


Thanks David

Sign in to reply to this post

Jason ByrnesWebAssist

it's tough for me to tell exactly what you are doing here because you are not giving me the whole code block, the truncated code does not help.


I'm assuming you are doing the str_replace on the $pkey variable?

you can do more than one str_replace operation on the same variable, here is example code that would change a form element name "naam2" to "name" and another named "naamlast" to "last name"

php:
echo(str_replace("naam2","name",str_replace("naamlast","last name",$pkey)));



for more details see the str_replace manual page on the php sire:
function.str-replace.php

Sign in to reply to this post

tone397472

Thanks Jason! I'm going to try it!
David

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

tone397472

Hi, The code works perfect to replace 2 items now, but I cant find out how to at more. I need to replace 5 items.
Can you please give me a example with more then 2.

what I have now:
echo(str_replace("naam2","name",str_replace("naamlast","last name",$pkey)));

Thanks David

Sign in to reply to this post

tone397472

Sorry it was a typo! Missed a ) .
Thanks David

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...