php display a multiple-line variable

Permalink
Hello,
I have a multiple-line text variable called "Short itinerary" but am having problems returning it on the page.

The following code works fine when "Short itinerary" is a single line of short text. But when "Short itinerary" is multiple-line text nothing is returned. I think it's something to do with multiple-line text being an array, but I'm not sure how this should be coded in the php.

Help very much very welcome!! :)

[code]
<?php
$shortitins = $tour->xpath('custom_fields/field[name="Short itinerary"]/value');
foreach($shortitins as $shortitin) {
print $shortitin;
}
?>

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi PJSAndo,

Are you familiar with using var_dump() to debug your PHP?
http://php.net/manual/en/function.var-dump.php...

It can help provide more information about your variables.

Example:
<?php 
$shortitins = $tour->xpath('custom_fields/field[name="Short itinerary"]/value'); 
var_dump($shortitins);
foreach ($shortitins as $shortitin) {
    print $shortitin;
}
?>

- check the value of $shortitins when you know it is a single line of text
- check the value of $shortitins when you know it is multiple lines of text
PJSAndo replied on at Permalink Reply
Thanks.

In fact, where the data are stored the variable has 'Name' and 'Tag'. In the php I was referencing the Name whereas I should have been pointing to the Tag.

Works now.
cheers