fork download
  1. <html><body>
  2. <?php
  3. $s = '';
  4. $b = strip_tags( @file_get_contents( __FILE__ ), '<tr><td>');
  5. if ( preg_match_all("#<tr[^<]+?(.+?)</tr#is", $b, $trs , PREG_SET_ORDER) ) {
  6. $a = array();
  7. foreach( $trs as $tr ) {
  8. if ( preg_match_all("#<td[^>]*>(\d+)</td>#is", $tr[1], $tds , PREG_SET_ORDER) ) {
  9. $a[] = '<option value="' . $tds[0][1] . '">' . $tds[0][1] . '回</option>';
  10. }
  11. }
  12. $a = array_unique( $a, SORT_REGULAR );
  13. $a[] = preg_replace( '#([^>]+?)>(.+)#', '$1 selected="selected">$2', array_pop( $a ) );
  14. $s = '<select name="kai1">' . "\n";
  15. $s .= join( $a, "\n" ) . "\n";
  16. $s .= '</select>' . "\n";
  17. }
  18. echo ( $s );
  19. ?>
  20. <TABLE>
  21. <tr>
  22. <td><input type="checkbox" class="hikakubox"/></td>
  23. <td>1</td>
  24. </tr>
  25. <tr>
  26. <td><input type="checkbox" class="hikakubox"/></td>
  27. <td>1</td>
  28. </tr>
  29. <tr>
  30. <td><input type="checkbox" class="hikakubox"/></td>
  31. <td>2</td>
  32. </tr>
  33. <tr>
  34. <td><input type="checkbox" class="hikakubox"/></td>
  35. <td>3</td>
  36. </tr>
  37. </TABLE></body></html>
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
<html><body>
<select name="kai1">
<option value="1">1回</option>
<option value="2">2回</option>
<option value="3" selected="selected">3回</option>
</select>
<TABLE>
<tr>
<td><input type="checkbox" class="hikakubox"/></td>
<td>1</td>
</tr>
<tr>
<td><input type="checkbox" class="hikakubox"/></td>
<td>1</td>
</tr>
<tr>
<td><input type="checkbox" class="hikakubox"/></td>
<td>2</td>
</tr>
<tr>
<td><input type="checkbox" class="hikakubox"/></td>
<td>3</td>
</tr>
</TABLE></body></html>