what im doing is creating a script that allows users to create HREFs. they type in a string, select some word(s) and hit a button and my script inserts <a href="" and title=""></a> wrapped around selected word(s).
example - my string looks like this:
<p>this is a link to <a title="google" href="http://www.google.co.uk
">google</a> and this is a link to <a title="google" href="http://www.quest-recruiting.com
as you can see, my second url title is google again. i got help from hernst42 with extracting all the href title values from a string and i have these stored in an array called $titles.
so what i did next was this:
foreach($titles as $title)
$data = str_replace('title=""','ti
but it isnt correct either. how would you suggest i fix this? basically i want to get the value between all the <a></a>'s in the string and insert that value into the correct <a title="" href=""></a>...