close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Best way to replace dynamic values?

Thread began 8/17/2017 3:41 pm by Steve | Last modified 8/18/2017 10:49 am by Ray Borduin | 763 views | 4 replies |

Steve

Best way to replace dynamic values?

Using the basic templates that come with Universal Email we are able to quickly create usable email templates that populate all the values from the parent form. Cool!
We can also use the Remove function to exclude some inputs from the results. Great.

What would be the best coding method to replace a found Post value with something more user friendly?

Is it a second layer of String Replace? Though that seems confusing as the current method steps through an array of values.

Seems we'd need create a list of the known Post values and then replace those when encountered. Any tips on best practice on how to do this? The reason is I've changed the ID of the Comment area to thwart spam bots using Xrumer which is ridiculously effective and bypassing Honeypot and even ReCaptcha validation methods.

Target area:

<?php echo(str_replace("_"," ",$pkey)); ?>




Full Code from area in question:

<?php
foreach( $_POST as $pkey => $pval ){
if (!RemoveValue($pkey,$remove,$removeBegins,$removeEnds,$removeIncludes)) {
?>
<tr valign="top">
<th style="font-size: 12px; width: 134px; text-align: right; padding: 3px 10px 3px 3px; font-weight: bold;"><?php echo(str_replace("_"," ",$pkey)); ?>:</th>
<td style="font-size: 12px; padding: 3px;"><?php echo(str_replace("\n","<BR />",(is_array($pval)?implode(", ",$pval):$pval))); ?></td>
</tr>
<?php
}
}
?>
Sign in to reply to this post

Ray BorduinWebAssist

What is the exact field you want updated and what do you want it updated to and from? You would probably need an IF statement and possibly a str_replace(), but it depends on what exactly you are doing. I can give you sample code, but I need specifics.

Sign in to reply to this post
Did this help? Tips are appreciated...

Steve

Hi Ray,
field is :

<textarea name="78YesterdaySGD" id="78YesterdaySGD" cols="55" rows="10"></textarea>

so the update would be from "78YesterdaySGD" to "Comments"

Sign in to reply to this post

Ray BorduinWebAssist

This section:

<?php
foreach( $_POST as $pkey => $pval ){
if (!RemoveValue($pkey,$remove,$removeBegins,$removeEnds,$removeIncludes)) {
?>

just add an IF statement like:

<?php
foreach( $_POST as $pkey => $pval ){
if (!RemoveValue($pkey,$remove,$removeBegins,$removeEnds,$removeIncludes)) {
if ($pkey == "78YesterdaySGD") $pkey = "Comments";
?>

Sign in to reply to this post
Did this help? Tips are appreciated...

Steve

Thanks Ray!

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...