|
Posted by feed_sheep on 11/06/90 11:31
<laredotornado@zipmail.com> wrote in message
news:1131133990.080538.174740@f14g2000cwb.googlegroups.com...
> <?php
> $str = "&mine=20&agency_id=234&test=abc";
> $search = "/agency_id=\\d+/i";
> $replace = "agency_id=<?php echo \$LTON; ?>";
> $retVal = preg_replace($search, $replace, $str);
> print $retVal;
> ?>
I can't see how you have it set up, but if a previous page does not pass the
variable $LTON, it will of course equal nothing. Also, you are putting
<?php ?> instead of <?php ?> tags.
This code works:
<?php
$LTON = 1;
$str = "&mine=20&agency_id=234&test=abc";
$search = "/agency_id=\d+/i";
$replace = "agency_id=" . $LTON;
$retVal = preg_replace($search, $replace, $str);
print $retVal;
?>
David
Navigation:
[Reply to this message]
|