0

これが私のphpの一部です-

echo "<table border='0'>";
while($list = mysql_fetch_assoc($result))
echo "<tr>";
echo "<td>" . $list['SALEPRICE']."</td>";

FOLLOWINGBUYURLにリンク付きのボタンを配置したい。

echo "<td><a target='new' href=\"" . $list['BUYURL'] . "\"><b>VISIT STORE NOW</b></a></td>";
 echo "</tr>";
echo "</table>";
4

3 に答える 3

1

while次のような中括弧がないと、ループは期待どおりに機能しません。

echo "<table>";
while ( $list = mysql_fetch_assoc( $result ) ) {
  echo "<tr>
          <td>".$list['SALEPRICE']."</td>
          <td><a target='_new' href='".$list['BUYURL']."'>Visit Store</a></td>
        </tr>";
}
echo "</table>";

そこにボタンを配置するのではなく、アンカーをボタンのように見せます。

<style>
  table a {
    font-family: "Helvetica Neue", Helvetica, Arial;
    font-size: 13px;
    background: #f1f1f1;
    text-decoration: none;
    color: #555;
    padding: 5px;
    border-radius: 2px;
    box-shadow: 1px 1px 0px 0px #CCC;
    text-shadow: 0 1px 0 #fff;
  }
</style>
于 2012-04-28T05:30:56.753 に答える
1

tdタグの背景色をボタンの色にするだけで、ボタン効果が得られます。

<td style=\"background-color: red\"> // Or whatever color.

または、tdタグ内にボタンを配置します

<td><button><a href="#">BUYURL</a></button></td>
于 2012-04-28T05:36:07.040 に答える
0

こんなことしてみませんか?

echo "<table border='0'>";
while($list = mysql_fetch_assoc($result)){
$saleprice = $list['SALEPRICE'];
$buyurl = $list['BUYURL'];

echo "<tr>
     <td>$saleprice</td>
     <td><a target='new' href='$buyurl'><b>VISIT STORE NOW</b></a></td>
     </tr>";
} // end while
     echo "</table>"; // end table since the table was constructed BEFORE the loop

ボタン用

<button type='button'>VISIT STORE NOW</button>

また

<input type='submit' value='VISIT STORE NOW'>

または標準の画像か何か。「それらをエスケープするために」を使用する必要があるかどうかを確認してください

于 2012-04-28T05:30:32.283 に答える