Hello,
just making an update link using pop up box but dont know how would i be able to get the id though
here is my code
<?php
$get_query = "SELECT * FROM shortenedurls WHERE uid=".$id;
$query = mysqli_query($connection, $get_query);
while($record = mysqli_fetch_array($query)) {
$url = $record['url'];
$longurl = $record['longurl'];
$ida = $record['id'];
echo "<div class='entries'>";
echo "<div class='col-md'><a href='$longurl'>". $longurl ."</a></div>";
echo "<div class='col-md'><a href='$url'>". $url ."</a></div>";
echo "<div class='col-md smwidth1'>". $ida ."</div>";
echo "<div class='col-sm smwidth2'><a href='#myModal2?id=$ida' data-toggle='modal' data-target='#myModal2'><i class='fa fa-pencil-square-o'></i></a></div>";
echo "<div class='col-sm smwidth2'><a href='includes/delete.php?id=$id&delete=$ida&code=$coupen'><i class='fa fa-trash-o'></i></a></div>";
echo "<div class='clear'></div>";
echo "</div>";
}
?>
and to show on model
<!-- Modal -->
<div class="modal fade" id="myModal2" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
<form method="post" action="includes/update.php?id=<?php echo $id.'&code='.$coupen; ?>">
<?php echo links($ida); ?>
<input type="submit" value="update" name="update" class="logout" />
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
links($ida) is a fuinction here is the coed for it
function links($id) {
global $connection;
$get_query = "SELECT * FROM shortenedurls WHERE id='$id'";
$query = mysqli_query($connection, $get_query);
while($record = mysqli_fetch_assoc($query)) {
$url1 = $record['url'];
$url2 = $record['longurl'];
$ida = $record['id'];
$output = "<div class='entries'>";
$output .= "<div class='col-md'><input type='text' name='url' value='$url1' /></div>";
$output .= "<div class='col-md'><input type='text' name='url2' value='$url2' /></div>";
$output .= "<div class='col-md'><input type='text' name='short' value='$ida' /></div>";
$output .= "<div class='clear'></div>";
$output .= "</div>";
return $output;
}
}