modifying another’s code. need help adding another $var to pattern. there are 2 in there already. need a 3rd.
THEIR CODE:
$link=‘%<a\s[^<>]?href=“http://([\w-_./?&=#]{5,})”[^<>]?>([^<>]*?)</a>%’;
$_POST[“description”] = preg_replace($link,‘[$1|$2]’,$row[“description”]);
I NEED SOMETHING LIKE THIS:
$link=‘%<a\s[^<>]?href=“http://([\w-_./?&=#]{5,})”[^<>]?>([^<>]?>)([^<>]?) </a>%’;
$_POST[“description”] = preg_replace($link,‘[$1|$2|$3]’,$row[“description”]);
but it’s not working… do I have a syntax problem???
all vars present in URL, but just the value for id prints… why not cd!! have tried re-arranging things and substituting literal values with no luck, and no more ideas.
#############################################
after posting the above I find this code:
$link=‘%<a\s[^<>]?href=“http://([\w-_./?&=#]{5,})”[^<>]?>([^<>]*?)</a>%’;
$_POST[“description”] = preg_replace($link,‘[$1|$2]’,$row[“description”]);
runs AFTER my:
if ($access) { echo " onclick=\“x=eventWin('index.php?cP=11&id=”.$eid.“&cd=”.$date.“'); x.focus(); return false;\”"; }
I’d have to see more of your code instead of just these partial snippets, but WHATEVER it is you are trying to do here, I think you are VASTLY over-thinking it… though it could just be your use of string additions and double quotes instead of delimits with singles making it hard to read (and slower to run).
I’m still unclear just what that regex is supposed to accomplish and/or what you are using it for since you don’t seem to be showing what you do with the result. Of course if the underlying script was doing things right it should probably be hooking the div instead of filling the markup with onclick…
thanks deathshadow, and you’re right. I went back to square one.
still don’t know why the hell I can’t $_GET that var from the URL, especially when I can get the other 2 up there. wanted the solution because I want to learn. but enough is enough, and there is more than one way to skin a cat.
my “solution” was just to add the var to form as hidden - a true solution here is more trouble than it’s worth.
so all is well now, and thank you and everyone else for your help!