Hi Leo,

Actually I do this with preg_replace().

A code might like this:

--- begin code ---

// if url taken from browser url address
$querystring = $_SERVER['QUERY_STRING'];
$newurl = preg_replace('/(var1)=([0-9].*)&(.*)$/', '\1=20&\3',
$querystring );

// if url taken from string
$url = http://www.foo.com/test.php?var1=20&var2=10
list(, $querystring) = explode('?', $url);
$newurl = preg_replace('/(var1)=([0-9].*)&(.*)$/', '\1=20&\3',
$querystring );

--- end code ---

Good Luck,
    Firman

----- Original Message -----
From: "Leo Divinagracia" <[EMAIL PROTECTED]>
Cc: "[PHP-WIN]" <[EMAIL PROTECTED]>
Sent: Tuesday, March 16, 2004 8:35 PM
Subject: [PHP-WIN] help with _PHP_SELF and changing a paramter in URL...


> sorry, it's late gotta get some sleep, but this had been stumping me...
>
> have to change a value in the URL, say:
>
> www.foo.com/test.php?var1=10&var2=10
>
> i want to make that a clickable link but set var1 = 20.  i'm getting
> tired so i may not be searching php.net correctly...
>
> would i EREGI_REPLACE it or some other way?
>
> the link i want to set it is
>
> www.foo.com/test.php?var1=20&var2=10
>
> thanks...
>
> --
> Leo G. Divinagracia III
> [EMAIL PROTECTED]
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to