DBが絡んだときのHTMLに埋め込んだphp例
DBが絡んだときのHTMLに埋め込んだphp例
<?php
$records = array(
array('name’ => 'aaa’, 'email’ => 'aaa@xxx.co.jp’, 'id’ => '1’),
array('name’ => 'bbb’, 'email’ => 'bbb@xxx.co.jp’, 'id’ => '2’),
array('name’ => 'ccc’, 'email’ => 'ccc@xxx.co.jp’, 'id’ => '3’)
);
?>
<html>
<head>
</head>
<body>
<table>
<?php foreach ($records as $record) : ?>
<tr>
<td><?php echo $record['name’] ?></td>
<td><?php echo $record['email’] ?></td>
<td><input type=’button’ value=’詳細’ onclick="location.href=’detail.php?id=<?php echo $record['id’] ?>'" /></td>
</tr>
<?php endforeach ?>
</table>
</body>
</html>