I am new to this web development kind of thing, I'm using bootstrap.
Here is my table:
<table class="table table-striped table-bordered">
<thead>
<tr>
<th style="text-align:center;"> ITEM CODE </th>
<th style="text-align:center;"> SIZE </th>
<th style="text-align:center;"> COLOR </th>
<th style="text-align:center;"> ACTION </th>
</tr>
</thead>
<tbody>
<?php
include('connect.php');
$result = mysql_query("SELECT * FROM products");
while($row = mysql_fetch_array($result))
{
echo '<tr>';
echo '<td style="text-align:center;">'.$row['itemcode'].'</td>';
echo '<td style="text-align:center;">'.$row['size'].'</td>';
echo '<td style="text-align:center;">'.$row['color'].'</td>';
echo '<td style="text-align:center;"><a data-toggle="modal" data-target="#editProductsModal" href="#?itemcode='.$row['itemcode'].'&size='.$row['size'].'&color='.$row['color'].'">edit</a></td>';
echo '</tr>';
}
?>
</tbody>
</table>
I'm trying to call the modal on that last td tag right there.
Here is my modal:
<div class="modal fade" id="editProductsModal" tabindex="-1" role="dialog" aria-labelledby="largeModal" aria-hidden="true">
<?php
include('connect.php');
$itemcode=$_GET['itemcode'];
$size=$_GET['size'];
$color=$_GET['color'];
$result = mysql_query("SELECT * FROM products where itemcode='$itemcode' and size='$size' and color='$color'");
while($row = mysql_fetch_array($result))
{
$name=$row['name'];
}
?>
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h1 class="modal-title" id="myModalLabel">Edit Products</h1>
</div>
<div class="modal-body">
<input type="text" class="form-control input-sm" placeholder="Product name" value="<?php echo $name;?>"></input>
</div>
<div class="modal-footer">
<a href="execEditProduct.php" class="btn btn-primary btn-lg">DO IT!</a>
</div>
</div>
</div>
</div>
Now, if I can just echo that product name on that textbox right there, it will be fine. But I haven't achieved it till now.
In html if you want the input to have a value inside of it you give it a "value".
So it would be
<input type.... value=<?php echo $name ?></input>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.