所以我用php上的循环动态创建了一些按钮 看起来像这样
while($row = mysql_fetch_array($sql))
{
$id = $row["DeviceID"];
$name = $row["Name"];
$description = $row["Description"];
$location = $row["Location"];
$image = $row["image"];
$dynamicList .= '<div class="section">
<div class="container">
<div class="row">
<div class="col-md-6">
<img src="'.$image.'" class="img-responsive">
</div>
<div class="col-md-4">
<h1 class="text-success">The Light is ON</h1>
<h3>'.$_SESSION['Username'].'s '.$name.' ('.$location.')</h3>
<p>Light Location: '.$location.'<br>Light Description: '.$description.'<br><br><br><br><br>Intelligent Hours<br><br>Weekdays<br>7:00am - 7:45am <br>5:45pm - 7:30pm<br>8:30pm - 11:30pm<br><br>Weekends<br>TBD </p>
</div>
<div class="col-md-2">
<button type="submit" name="login" id="login" class="btn btn-default">Login</button>
<!--<button type="submit" name="button" id="button'.$id.'" value="'.$id.'" class="btn btn-default">Toggle Off</button>-->
</div>
</div>
</div>
</div>';
}
当我尝试在用户触发它时捕获它时,它无法正常工作
我正在捕捉它
<?php
if(isset($_REQUEST['login']))
{
echo "<script type='text/javascript'>alert('button with Value = '.$value.'')</script>";
}
&GT;
我不知道为什么它没有抓住我点击按钮。
你的帮助非常适合