Jump to content

Multiple Lines in Array Value


doubledee

Recommended Posts

I have a Description field that gets sent to my Payment Gateway which can be put in an e-mail to my customer after a successful purchase.

 

Is it possible to have multiple lines and line-breaks in one Array Value??

 

For example...

 

$post_values = array(
	"x_description" => "Fuzzy Sweater
				Girls
				Medium
				Long-Sleeve
				$75",

 

 

Debbie

 

Link to comment
Share on other sites

Do you want to store it that way or show it like that?

 

Good catch!!

 

The answer is "Yes!"

 

I would like to do both, although my original question was meant to ask "How can I insert carriage returns in the Array Value so when it is inserted into the Confirmation Email the customer sees the results on several lines?"

 

 

Confirmation Email

This is to confirm that you just bought:

 

Fuzzy Sweater

Girls

Medium

Long-Sleeve

$75

 

Thanks,

 

 

 

Debbie

 

Link to comment
Share on other sites

storing them like that isnt really important..so i would store them like a normal array...to display them like that I would use a foreach loop

 

foreach($post_values as $array_values)  {

echo $array_values . "<br />";
}

 

something like that

Link to comment
Share on other sites

storing them like that isnt really important..so i would store them like a normal array...to display them like that I would use a foreach loop

 

foreach($post_values as $array_values)  {

echo $array_values . "<br />";
}

 

something like that

 

You're missing my point...

 

The Payment Gateway gives me ONE FIELD to insert Comments, and I want it printed out on multiple lines like mentioned above.

 

Unfortunately have a separate field for each thing isn't possible.

 

$post_values = array(

"x_description" => "Fuzzy Sweater

Girls

Medium

Long-Sleeve

$75",

 

 

 

Debbie

 

 

Link to comment
Share on other sites

You mean like this?

 

$post_values = array(

      "x_description" => "Fuzzy Sweater\n

              Girls\n

              Medium\n

              Long-Sleeve\n

              $75");

 

echo nl2br($post_values[0]);

Link to comment
Share on other sites

You mean like this?

 

$post_values = array(

      "x_description" => "Fuzzy Sweater\n

              Girls\n

              Medium\n

              Long-Sleeve\n

              $75");

 

echo nl2br($post_values[0]);

 

That is what I was thinking, but it looks like they strip out the "\n"  :-\

 

 

 

Debbie

 

Link to comment
Share on other sites

If it's just a comment field, can you simply use a <br>?

 

I tried both combinations and it just prints <br> in my description.

 

"x_description" => "A quick brown fox jumps over the lazy dog.
			<br> A quick brown fox jumps over the lazy dog.
			<br> A quick brown fox jumps over the lazy dog.",

 

 

The output keeps coming up...

A quick brown fox jumps over the lazy dog. <br> A quick brown fox jumps over the lazy dog. <br> A quick brown fox jumps over the lazy dog.

 

Guess I'll just have to live with a long, continuous line that wraps.  :-\

 

 

 

Debbie

 

 

Link to comment
Share on other sites

Where does the email originate? From your server, or the payment processor's server?

 

From Authorize.net

 

I pass them:

 

"x_description" => "This is a description..."

 

and they return it and other pre-determined data is a pre-made Customer Receipt which they send to the customer directly.

 

 

Debbie

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.