<?php $nn = $_REQUEST['n']; if (!$nn || $nn > 500) $nn = 8;
$url3 = "http://th.r24.org/xmlR24review.php?p=AGENT.DOMAIN&n=".$nn;
$url3 .= "&d=".date("Y-m-d",strtotime('-2 years')); # not older than 2 years
$r = trim($_REQUEST['r']); if ($r) $url3 .= "&r=".$r; # add region filter
$t = trim($_REQUEST['t']); if ($t) $url3 .= "&t=".$t; # add fulltext-search
$xml3 = simplexml_load_file($url3) or die("Sorry, can't open this: ".$url3); ?>
<!-- <%=$url3%> -->
<div class="centertable">
<div class="navi">
<?php $url1 = "http://TH.R24.org/xmlR24db.php?p=AGENT.DOMAIN&db=region";
$xml1 = @simplexml_load_file($url1) or die("Sorry, can't open this: ".$url1); ?>
<form method="post" action="xmlR24demo3.php" name="revform_t" id="revform_t" style="margin:0">
<select name="r" class="select">
<option value="0" selected >- Regions -</option>
<?php if ($xml1) foreach ($xml1->region as $region) { $sel = ($region['r'] == $r) ? "selected":""; ?>
<option value="<?php echo $region['r']; ?>" <%=$sel%>> <?php echo $region->region_en; ?> </option>
<?php } /* foreach */ ?>
</select><input name="t" type="text" class="select" size="20" maxlength="30" value="<%=$t%>">

<input name="submit1" type="submit" value="search" class="button">
<input name="n" type="hidden" value="<%=$nn%>">
</form>



</div>
<table class="table1">
<tr class="thead">
<td style="white-space:nowrap; width: 150px;">Period of stay</td>
<td style="width: 60%">comment on the hotel</td>
<td>about reservation service</td>
</tr>

<?php
for ($n=0; $n < $xml3['records']; $n++) { $review = $xml3->review[$n];
$story = $review->story;
if ($t) $story = eregi_replace($t, '<span class="mark">'.$t.'</span>', $story); # highlight search
?>
<tr class="<?php echo ($n % 2) ? "col1":"col2"; ?>" id="R<?php echo $review['key']; ?>">

<td><strong><?php echo date("M d, Y",strtotime($review->visitdate)); ?></strong><br>
<?php echo $review->guestname; ?>
</td>

<td><strong><a href="<?php echo $review->hotellink2; ?>" title="<?php echo $review->hno; ?>" target="_blank">
<?php echo $review->hotelname.", ".$review->hoteladr; ?></a></strong><br>
<?php echo $story; ?>
</td>

<td><?php echo $review->reservation; ?></td>

</tr>
<?php } /* for */ ?>

</table>
</div>