Posted by niftyhawk on 03/22/06 01:29
Hi All,
I have the HTML in "Output A" generated dynamically and stored in a PHP
variable say $contents.
I want this to parse and insert checkboxes in the code which have to
look like "OUTPUT B". The checkbox value should be the value of
"query=" in the "href tag".
OUTPUT A
=========
<table width="100%">
<tr><td align="left" valign="top" width="20px">1. </td>
<td align="left" colspan="3">
<span class="resultTitle"><a
href="http://www.xyz.com/guest?setting_key=files&query=35907580">Cats
(Port Orange, Fla.)</a></span><br />
<tr>
<td colspan="4">
<img src="http://www.xyz.com/website/images/backgroundPixel.gif"
width="100%" height="1" alt="divider" />
</td>
</tr>
<tr><td align="left" valign="top" width="20px">2. </td>
<td align="left" colspan="3">
<span class="resultTitle"><a
href="http://www.xyz.com/guest?setting_key=files&query=09432400">Yearbook
(Cat Fanciers' Association)</a></span><br />
<tr>
<td colspan="4">
<img src="http://www.xyz.com/website/images/backgroundPixel.gif"
width="100%" height="1" alt="divider" />
</td>
</tr>
</table>
OUTPUT B
=========
<table width="100%">
<tr><td align="left" valign="top" width="20px">1. </td>
<td align="left" colspan="3">
<span class="resultTitle"><input type=checkbox name=checkarray[]
value="35907580"><a
href="http://www.xyz.com/guest?setting_key=files&query=35907580">Cats
(Port Orange, Fla.)</a></span><br />
<tr>
<td colspan="4">
<img src="http://www.xyz.com/website/images/backgroundPixel.gif"
width="100%" height="1" alt="divider" />
</td>
</tr>
<tr><td align="left" valign="top" width="20px">2. </td>
<td align="left" colspan="3">
<span class="resultTitle"><input type=checkbox name=checkarray[]
value="09432400"><a
href="http://www.xyz.com/guest?setting_key=files&query=09432400">Yearbook
(Cat Fanciers' Association)</a></span><br />
<tr>
<td colspan="4">
<img src="http://www.xyz.com/website/images/backgroundPixel.gif"
width="100%" height="1" alt="divider" />
</td>
</tr>
</table>
Can anybody help me with a code sample as to how to do this?
Thanks
[Back to original message]
|