TOPIC:

added values, then new line 4 months 2 weeks ago #247555

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 367
  • Thanks: 0
Hi

I have a textarea with auto populated values, this is the code.
<?php

$Select3= base64_decode(JRequest::getVar("JoinValue", ""));

$exploded3 = explode("\n", $Select3);

$count = count($exploded3);
$list = '';
for($i = 0; $i < $count; $i++){
    
    $list .=  $exploded3[$i]  . 'm' . "\n"  ;

}

return $list;
?>

I need the "m" to appear next to the value on the same line.. Here is a screen shot of current output.

Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by mrperfectpz.

added values, then new line 4 months 2 weeks ago #247583

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 807
Hi,

please try this, it seems you are not using the separators in the list definition:
<?php

$Select3= base64_decode(JRequest::getVar("JoinValue", ""));

$exploded3 = explode("\n", $Select3);

$count = count($exploded3);
$list = '';
for($i = 0; $i < $count; $i++){
    
    $list .=  '0;' . $exploded3[$i]  . 'm;' . $exploded3[$i]  . "\n"  ;

}

return $list;
?>

Please Log in or Create an account to join the conversation.

added values, then new line 4 months 2 weeks ago #247584

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 367
  • Thanks: 0
Hi Markus

Although it has "$list" it isnt a list it is a textarea. I need to explode the values and add "m" to the end of each please.

Regards
Jerry

Please Log in or Create an account to join the conversation.

added values, then new line 4 months 2 weeks ago #247639

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 807
Ah, my bad. It looked like a multiple-select list (they are lookalike).
However, I am not sure but it can be that there is still a "\r" newline attached to the entries.

Your code seems to be fine, so let's try to trim it
<?php

$Select3= base64_decode(JRequest::getVar("JoinValue", ""));

$exploded3 = explode("\n", $Select3);

$count = count($exploded3);
$list = '';
for($i = 0; $i < $count; $i++){
    
    $list .=  trim($exploded3[$i])  . 'm' . "\n"  ;

}

return $list;
?>

That's so far the only explanation for the linebreaks in the textarea and the trim() should get rid of that if there is any as it removes any whitespace.

If they still break, then please inspect the html of the textarea and post a screenshot. Because then it might be something else (like a html-entity converted character or something like that).

Regards,
Markus

Please Log in or Create an account to join the conversation.

added values, then new line[solved] 4 months 2 weeks ago #247642

  • Topic Author
  • mrperfectpz
  • Offline
  • Gold Breezer
  • Gold Breezer
  • Posts: 367
  • Thanks: 0
Hi Markus

That works PERFECT !!! Thankyou !!!!

Regards
Jerry

Please Log in or Create an account to join the conversation.

Last edit: Post by mrperfectpz.

added values, then new line[solved] 4 months 2 weeks ago #247666

  • TheMuffinMan's Avatar
  • TheMuffinMan
  • Offline
  • Developer
  • Developer
  • Posts: 10064
  • Karma: 167
  • Thanks: 807

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.075 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!