troubleshooting Question

Auto-Appending Query String to URL's on Condition

Avatar of EMB01
EMB01Flag for United States of America asked on
PHPWeb Development
15 Comments1 Solution963 ViewsLast Modified:
How do I append a querystring to a URL when the URL is inside a bunch of HTML? Furthermore, how do I append upon two conditions; one, if the URL doesn't contain a "?" and, two, if the URL does contain a "?"

Example attached.
<p>The following link should change to ""</p>
<a href="">Link without original querystring</a>
<br />
<p>The following link should change to ""</p>
<a href="">Link with original querystring</a>
<br />
<p>So, there should be two separate variables two append for two different conditions. The questions are: </p>
<li>How do I find URL's from a variable containing HTML (like this one).</li>
<li>How do I replace the URL's based on the result?</li>
<p>Thank you!</p>

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros