我在while循环中有一个表。每一行都有一个图标,可在单击时启动模态。但每当我点击任何一行的图标时,它总是显示第一个数据。 我的代码中缺少什么?请帮助我:D
while($row = $sql->fetch()){
$id = $row['id'];
$company = $row['company_name'];
$domain = $row['domain_name'];
$industry = $row['industry_type'];
$websitet = $row['website_type'];
$websitep = $row['website_purpose'];
$audience = $row['target_audience'];
$web_pages = $row['web_pages'];
$color = $row['color_scheme'];
$style = $row['style'];
$addons = $row['addons'];
$url = $row['url_of_existing'];
$like_dislike = $row['like_dislike_existing_website'];
$sample = $row['sample_website'];
echo '<tr><td>'.$id.'</td>';
echo '<td>'.$company.'</td>';
echo '<td>'.$domain.'</td>';
echo '<td>'.$industry.'</td>';
echo "<td><a href='#openModal'><img src=img/view.png width=20px height=20px id='view'></a></td>";
echo "<td><img src='img/delete.png' width=20px height=20px name='delete'></td></tr>";
?></div>
<div id="openModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<!-- <h2>Modal Box</h2>
<h5>This is a sample modal box that can be created using the powers of CSS3.</h5>
<h5>You could do a lot of things here like have a pop-up ad that shows when your website
loads, or create a login/register form for users.</h5> -->
<form action="" method="post">
<label for="company_name"><strong>Company Name: </strong></label> <?php echo $company; ?>
<br>
<label for="company_name"><strong>Domain Name: </strong></label><?php echo $domain; ?>
<br>
<label for="company_name"><strong>Industry Type: </strong></label><?php echo $industry; ?>
<br>
<label for="company_name"><strong>Website Type: </strong></label><?php echo $websitet; ?>
<br>
<label for="company_name"><strong>Website Purpose: </strong></label><?php echo $websitep; ?>
<br>
<label for="company_name"><strong>Target Audience: </strong></label><?php echo $audience; ?>
<br>
<label for="company_name"><strong>Web Pages: </strong></label><?php echo $web_pages; ?>
<br>
<label for="company_name"><strong>Color Scheme: </strong></label><?php echo $color; ?>
<br>
<label for="company_name"><strong>Style: </strong></label><?php echo $style; ?>
<br>
<label for="company_name"><strong>Add ons: </strong></label><?php echo $addons; ?>
<br>
<label for="company_name"><strong>URL of existing website: </strong></label><?php echo $url; ?>
<br>
<label for="company_name"><strong>Like/Dislike of existing website: </strong></label><?php echo $like_dislike; ?>
<br>
<label for="company_name"><strong>Sample Website: </strong></label><?php echo $sample; ?>
</form>
</div>
</div>