URLencode and URLdecode

Good day,

I am developing a bookstore website, and I am having a little issue using URLencode and URLdecode.
The website offers to the customers a list of books, and the customers select what they want to purchase.
I load in a variable the list of names for all selected books, for e-mailing them to the customer after the purchase.
The problem is in the e-mail the books are listed one by one, instead of one per line, as I desire:

Current situation:
Here the list of books you have purchased:
book1 book2 book3 book4

Desired situation:
Here the list of books you have purchased:
book1
book2
book3
book4

The code
In the webpage where the books are selected:

Initial definition for variable to load the books list:
$Purchased_Books = "Libros adquiridos
";

Loading books in the variable (loop loads book name per each selected book)
$Purchased_Books .= $rows[$valor][1]."
";

    $URLPurchased_Books = urlencode($Purchased_Books);

Pass the variable to the next webpage, where the e-mail is sent:
<input type=“hidden” name=“Purchased_Books” value=<?php echo $URLPurchased_Books; ?> >

In the webpage where the e-mail is sent:
$Decoded_Purchased_Books = urldecode($URLPurchased_Books);

Adding the book list to the e-mail:
$message_body .= "Libros adquiridos: " .$Decoded_Purchased_Books. "
";

Thanks a lot!!!

Each time your loop runs you need to effectively parse a carriage return/ line feed. Clearly this is not happening.
Maybe there is a conflict between URLencode and/or URLdecode and your line feed syntax (
) or perhaps PHP’s troublesome MagicQuotes function has thrown a spanner in the works!
Maybe at this point ->

$Purchased_Books = "Libros adquiridos\
";

try substituting a <br /> tag immediately after adquiridos.

Just a thought

Just use a different separator, like a pipe (|), no need to force yourself to use a newline