Reply to Parsing and replacing in PHP

Your name:

Reply:


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.&nbsp;</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.&nbsp;</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.&nbsp;</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.&nbsp;</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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация