This is cart view
<div id="cart" >
<div id="text">
<?php $cart_check = $this->cart->contents();
// If cart is empty, this will show below message.
if(empty($cart_check))
{
echo 'To add products to your shopping cart click on "Add to Cart" Button';
} ?> </div>
<table id="table" border="0" cellpadding="5px" cellspacing="1px" class="table table-hover" style="padding: 0px;margin: 0px;text-align: center">
<?php
// All values of cart store in "$cart".
if ($cart = $this->cart->contents()): ?>
<tr id= "main_heading">
<td width="5%">Serial</td>
<td width="30%">Name</td>
<td width="20%">Price</td>
<td width="10%">Qty</td>
<td width="25%">Amount</td>
<td width="10%">Cancel Product</td>
</tr>
<?php
// Create form and send all values in "shopping/update_cart" function.
echo form_open('index.php/cart/update_cart');
$grand_total = 0;
$i = 1;
foreach ($cart as $item):
// echo form_hidden('cart[' . $item['id'] . '][id]', $item['id']);
// Will produce the following output.
// <input type="hidden" name="cart[1][id]" value="1" />
echo form_hidden('cart[' . $item['id'] . '][id]', $item['id']);
echo form_hidden('cart[' . $item['id'] . '][rowid]', $item['rowid']);
echo form_hidden('cart[' . $item['id'] . '][name]', $item['name']);
echo form_hidden('cart[' . $item['id'] . '][price]', $item['price']);
echo form_hidden('cart[' . $item['id'] . '][qty]', $item['qty']);
?>
<tr>
<td>
<?php echo $i++; ?>
</td>
<td>
<?php echo $item['name']; ?>
</td>
<td>
$ <?php echo number_format($item['price'], 2); ?>
</td>
<td>
<?php echo form_input('cart[' . $item['id'] . '][qty]', $item['qty'], 'maxlength="3" size="1" style="text-align: center"'); ?>
</td>
<?php $grand_total = $grand_total + $item['subtotal']; ?>
<td>
$ <?php echo number_format($item['subtotal'], 2) ?>
</td>
<td>
<?php
// cancle image.
?>
<a href="<?php echo base_url() ;?>index.php/cart/remove/<?php echo $item['rowid']?>">
<img src="<?php echo base_url(); ?>assets/images/cart/cart_cross.jpg" width='25px' height='20px'>
</a
<?php
// echo anchor('index.php/cart/remove/' . $item['rowid'], $path); ?>
</td>
<?php endforeach; ?>
</tr>
<tr class="info">
<td colspan="2" align="left"> <b>Order Total: $ <span style="font-weight: bold"> <?php
//Grand Total.
echo number_format($grand_total, 2); ?></span></b></td>
<?php // "clear cart" button call javascript confirmation message ?>
<td colspan="4" align="right"><input type="button" class ='fg-button teal' value="Clear Cart" onclick="clear_cart()">
<?php //submit button. ?>
<input type="submit" class ='fg-button teal' value="Update Cart">
<?php echo form_close(); ?>
<!-- "Place order button" on click send "billing" controller -->
<!-- <input type="button" class ='fg-button teal' value="Place Order" onclick="window.location = 'index.php/cart/billing_view'">-->
<button id="placeorder" type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal" data-whatever="#mdo" style="margin-left: 5px">Place Order</button>
</td>
</tr>
<?php endif; ?>
</table>
</div>
After click on placeholder button(above code) it will open bootstrap model.
Code of that is
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" style="text-align: left">
<div class="modal-dialog">
<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="exampleModalLabel">Tour Inquire Form</h4>
</div>
<?php
$grand_total = 0;
// Calculate grand total.
if ($cart = $this->cart->contents()):
foreach ($cart as $item):
$grand_total = $grand_total + $item['subtotal'];
endforeach;
endif;
?>
<form action="<?php echo base_url();?>index.php/cart/send_mail" method="POST" id="mailform">
<div class="modal-body">
<div class="form-group">
<label for="recipient-name" class="control-label">Name:</label>
<input type="text" class="form-control" name="name">
</div>
<div class="form-group">
<label for="recipient-name" class="control-label">E-Mail</label>
<input type="email" class="form-control" name="mail">
</div>
<div class="form-group">
<label for="recipient-name" class="control-label">Contact Number</label>
<input type="number" class="form-control" name="mob">
</div>
<div class="form-group">
<label for="recipient-name" class="control-label">Total Value of Your Product</label>
<input type="text" class="form-control" name="price" value="<?php echo $grand_total;?>" readonly>
</div>
<div class="form-group">
<label for="message-text" class="control-label">Message:</label>
<textarea class="form-control" id="message-text" rows="5" name="msg"></textarea>
</div>
</div>
<div class="modal-footer">
<input type="button" class="btn btn-default" data-dismiss="modal" value="Close">
<input type="submit" class="btn btn-primary" name="submit" value="Send Mail">
</div>
</form>
</div>
</div>
</div>
After user click on Send Mail, I need to send mail get data(html codes) from some other div(Mentioned below, Name mail_table)
and data should send to my mail controller.
<div id="mail_table" style="display: none">
<table cellpadding="6" cellspacing="1" style="width:100%" border="0">
<tr>
<th>QTY</th>
<th>Product Name</th>
<th style="text-align:right">Item Price</th>
<th style="text-align:right">Sub-Total</th>
</tr>
<?php $i = 1; ?>
<?php foreach ($this->cart->contents() as $items): ?>
<?php echo form_hidden($i.'[rowid]', $items['rowid']); ?>
<tr>
<td><?php echo $items["qty"] ?></td>
<td>
<?php echo $items['name']; ?>
<?php if ($this->cart->has_options($items['rowid']) == TRUE): ?>
<p>
<?php foreach ($this->cart->product_options($items['rowid']) as $option_name => $option_value): ?>
<strong><?php echo $option_name; ?>:</strong> <?php echo $option_value; ?><br />
<?php endforeach; ?>
</p>
<?php endif; ?>
</td>
<td style="text-align:right"><?php echo $this->cart->format_number($items['price']); ?></td>
<td style="text-align:right">$<?php echo $this->cart->format_number($items['subtotal']); ?></td>
</tr>
<?php $i++; ?>
<?php endforeach; ?>
<tr>
<td colspan="2"> </td>
<td class="right"><strong>Total</strong></td>
<td class="right">$<?php echo $this->cart->format_number($this->cart->total()); ?></td>
</tr>
</table>
</div>
all works fine with ajax.
<script>
$(function(){
$( "#placeorder" ).click(function(event){
event.preventDefault();
var htmlString = $("#mail_table").html();
$.ajax({
type : 'post',
url : '<?php echo base_url();?>index.php/cart/send_mail',
data : $('#form').serialize() + "table" + htmlString
});
});
});
</script>
but in controller when I assign data to
public function send_mail()
{
$name = $_POST['name'];
$mail = $_POST['mail'];
$mob = $_POST['mob'];
$price = $_POST['price'];
$msg = $_POST['msg'];
// $to =
$to = 'mail#gmail.com';
$to = 'my#gmail.com';
$subject = 'Enquiry from ' .$name;
$message = $_POST['table']; //Line 144
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
// $headers .= 'From: '.$_REQUEST['email'];
if(mail($to, $subject, $message, $headers))
{
}
}
But I'm getting error
A PHP Error was encountered
Severity: Notice
Message: Undefined index: table
Filename: controllers/cart.php
Line Number: 144
any idea???
Problem is this line of code in your view ajax. With this code table not send in your parameter. Also your form id is mailform
data : $('#form').serialize() + "table" + htmlString
It would be
data : $('#mailform').serialize() + "&table=" + encodeURIComponent(htmlString)
Related
I have popup it works normal i need to use method post to get my value from the input balise but the problem is when i do form the popup window displays in just a second then hide again and I need to click two time becausethe first time i got just the last result
<div class="List_modify">
<table class="list">
<thead class="topBar">
<tr>
<th>Prenom</th>
<th>Nom</th>
<th>CIN</th>
<th>Emails</th>
<th>Références</th>
<th>Photos</th>
<th>Niveau</th>
<th class="button_editer" style="vertical-align:middle"><span>Editer</span></th>
</tr>
</thead>
<?php $requet = "select * from Etudiants";
$resultat = mysqli_query($connecte, $requet);
while ($r = mysqli_fetch_array($resultat)) {
?>
<tbody class="container">
<tr>
<td>
<?php echo $r['Prenom']; ?>
</td>
<td>
<?php echo $r['Nom']; ?>
</td>
<td>
<?php echo $r['CIN']; ?>
</td>
<td>
<?php echo $r['Emails']; ?>
</td>
<td>
<?php echo $r['Matricule']; ?>
</td>
<td> <img src="image/<?php echo $r['Photo']; ?> " style="width: 150px; height:150px;"></td>
<td>
<?php echo $r['Niveau']; ?> </td>
<td>
<form method="POST" action="">
<input type="hidden" name="id" value="<?php echo $r['Id_Etudiant']; ?>">
<button class=" button" onclick="show()" style="vertical-align:middle" type="submit" name="submit"><span>Editer<i class=" fas fa-user-edit"></i></span>
</button>
</form>
</td>
</tr>
</tbody>
<?php } ?>
</table>
</div>
<div class="background_page_modify" id="page_modify" onclick="hide()">
<div class="page_etudiant" onclick="event.stopPropagation()">
<div class="closebtn" id="closebtn" onclick="hide()">
<div class="circle"> +</div>
</div>
<div class="etudiant_box">
<?php
if (isset($_REQUEST['submit'])) {
$checkid = $_REQUEST['id'];
echo $checkid;
}
?>
</div>
</div>
</div>
I use codeigniter pagination also here i use ajax to search so that the paging does not works. While click the paging link the full page is get reloaded .Actually i am not familiar with ajax so i dont know how this problem can be solved.Any help is appreciated.
Controller
public function chrgs_ajs_result()
{
$type = $this->input->post('catg');
$sdate = $this->input->post('start_date');
$edate = $this->input->post('end_date');
$result['error'] = "";
$result['res'] = "";
$result['res'] = $this->chrgs_edit_report_model->get_edit_amount($type,$sdate,$edate);
$config['base_url'] = base_url() . 'index.php/payment_edit/chrgs_ajs_result';
$config['total_rows'] = count($result['res']);
$config['per_page'] = 15;
$config["uri_segment"] = 3;
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$result['res'] = $this->chrgs_edit_report_model->get_edit_amount($type,$sdate,$edate,$config["per_page"], $page);
$result["links"] = $this->pagination->create_links();
//$result['res'] = $this->chrgs_edit_report_model->get_edit_amount($type,$sdate,$edate);
// echo "<pre>";
// print_r($result['res']);
if (!empty($result['res']))
{
$this->load->view('edit_charg_ajax_result',$result);
}
else
{
echo "No Result Found";
}
}
Ajax Result page
<table border="1" class="mainTable" cellpadding="0" cellspacing="0">
<tr> <?php if (isset($links)) { echo $links; } ?> </tr>
<tr style="background-color:#F2FAFF;color:#660">
<td width="3%">Sl No</td>
<td width="8%">Track Number</td>
<td width="8%">Old <?php echo $type; ?></td>
<td width="8%">New <?php echo $type; ?></td>
<td width="30%">Reason</td>
<td width="10%">Date</td>
<td width="10%">Requested By</td>
<td width="10%">Approved By</td>
<td width="10%">Approved IP</td>
</tr>
<?php
$i = 1;
foreach ($res as $value)
{
?>
<tr>
<td><?php echo $i; ?></td>
<td><?php echo $value['track_no']; ?></td>
<td><?php echo $value['old_value']; ?></td>
<td><?php echo $value['new_value']; ?></td>
<td><?php echo $value['reason']; ?></td>
<td><?php echo $value['added_on']; ?></td>
<td><?php echo $value['requested_by']; ?></td>
<td><?php echo $value['approved_by']; ?></td>
<td><?php echo $value['ip']; ?></td>
</tr>
<?php
$i++;
} ?>
Main Result page
<section>
<div class="content">
<div class="row">
<div class="col-md-12" style="margin-left: 2%;">
<div class="box">
<form class="form-horizontal" id="form">
<fieldset>
<div class="box-body">
<div class="col-md-12 row div1">
<div class="form-group col-md-4" style="margin-left: 80px;">
<label style="margin-top: 20px;"><b>Types:</b></label>
<div class="input-group" id="error">
<select class="form-control" id="catg" name="catg" style="width: 134%; border-radius: 5px;">
<option value="">--Select--</option>
<option value="charges">Charges</option>
<option value="delivery_at">Delivery_at</option>
<option value="doc_country">Doc_country</option>
<option value="doctype">Doctype</option>
<option value="mfa">Mfa</option>
<option value="package">Package</option>
<option value="sub_package">Sub_package</option>
</select>
</div>
</div>
<div class="form-group col-md-3" >
<label class="lmarg"><b>Start Date:</b></label>
<div class="input-group">
<div class="input-group-addon"> <i class="fa fa-calendar"></i> </div>
<input type="text" name="start_date" id="start_date" class="form-control datepicker">
</div>
</div>
<div class="form-group col-md-3" style="margin-left: 2px;">
<label class="lmarg"><b>End Date:</b></label>
<div class="input-group">
<div class="input-group-addon"> <i class="fa fa-calendar"></i> </div>
<input type="text" name="end_date" id="end_date" class="form-control datepicker">
</div>
</div>
<div class="form-group">
<label label class="lmarg" style="visibility: hidden;">search</label>
<div class="col-md-1 input-group">
<input type="button" class="btn pull-right" id="search_charge_edit" value="search">
</div>
</div>
</div>
</div>
</fieldset>
</form>
<div style="margin-top: 3%;margin-right: 1%;">
<div id="result" ></div>
</div></div>
</div>
</div>
</div>
$("#search_charge_edit").on("click",function(){
var controller_function = "<?php echo base_url();?>index.php/payment_edit/chrgs_ajs_result";
var post_data = $("#form").serialize();
$.ajax({
type:"post",
url:controller_function,
data:post_data,
success:function(data)
{
//alert(data);
//$('#form').trigger("reset");
$('#result').html(data);
}
});
});
I'm trying to work out how to update my shopping cart without updating other products. Should I be working with sessions here or not? MY current issue is that whenever I change the quantity it updates the other products as well and sets the quantity in the box back to 1. How would I go about changing this?
This is what I currently have, I understand why it updates all the products but I can't figure out how to do it otherwise.
<?php
session_start();
include("header.php");
include_once("dbconnect.php");
include("functies.php");
if (empty($_SESSION['cart'])) {
echo "U heeft geen producten in uw winkelwagen";
} else {
$items = $_SESSION['cart'];
$cartitems = explode(",", $items);
?>
<div align="center">
<?php titel(); ?>
<h1 Winkelwagen <h1>
</div>
<div class="container">
<div class="row">
<div class="col-sm-12 col-md-10 col-md-offset-1">
<table class="table table-hover">
<thead>
<tr>
<th>Product</th>
<th>Quantity</th>
<th class="text-center">Price</th>
<th class="text-center">Total</th>
<th> </th>
</tr>
</thead>
<tbody>
<?php
$total = 0;
$i=1;
foreach ($cartitems as $key=>$id) {
$sql = "SELECT * FROM products WHERE id = $id";
$res=mysqli_query($conn, $sql);
$r = mysqli_fetch_assoc($res);
$sqlb = "SELECT * FROM brewery WHERE code = $r[brewery_code]";
$resb=mysqli_query($conn, $sqlb);
$rb = mysqli_fetch_assoc($resb);
if (isset($_POST['submit'])) {
$amount = $_POST['amount'];
} else $amount = 1;
?>
<tr>
<td class="col-sm-8 col-md-6">
<div class="media">
<img class="thumbnail pull-left" src="Images/<?php echo $r['name'] ?>.jpg" width="85" height="152" alt="..." >
<div class="media-body">
<h4 class="media-heading"><?php echo $r['name']; ?></h4>
<h5 class="media-heading"> by <?php echo $rb['name'];; ?></a></h5>
<span>Status: </span><span class="text-success"><strong>In Stock</strong></span>
</div>
</div></td>
<td class="col-sm-1 col-md-1" style="text-align: center">
<form action="" method="post">
<input type="number" class="form-control" name="amount" value="1" min="1">
<input type="submit" name="submit" class="btn btn-primary btn-sm">
</form>
</td>
<?php
$total = $total + $r['price'];
$i++;
$producttotal = $amount * $r['price'];
?>
<td class="col-sm-1 col-md-1 text-center"><strong>€ <?php echo number_format($r['price'],2);?> </strong></td>
<td class="col-sm-1 col-md-1 text-center"><strong>€ <?php echo number_format($producttotal,2);?> </strong></td>
<td class="col-sm-1 col-md-1">
<button type="button" class="btn btn-danger">
Verwijderen
</button></td>
</tr>
<?php } ?>
</tbody>
<tfoot>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td><h5>Subtotal<br>Estimated shipping</h5><h3>Total</h3></td>
<td class="text-right"><h5><strong>$24.59<br>$6.94</strong></h5><h3>$31.53</h3></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td>
<button type="button" class="btn btn-primary"> Continue Shopping </button></td>
<td>
<button type="button" class="btn btn-primary"> Checkout </button>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<?php } ?>
Your form needs to contain an indicator for which product you want to increase the quantity. For example, like this:
<form action="" method="post">
<input type="number" class="form-control" name="amount[<?php echo $id;?>]" value="1" min="1">
<input type="submit" name="submit" class="btn btn-primary btn-sm">
</form>
You can then evaluate the id like this:
if (isset($_POST['submit']) && isset($_POST['amount'][$id])) {
$amount = $_POST['amount'][$id];
} else {
$amount = 1;
}
I don't understand why you would set the amount to 1 if it hasn't be set in the $_POST. I think you have to store the amount per product in the session, not just the ids as you are doing now.
Maybe like this:
if (isset($_POST['submit']) && isset($_POST['amount'][$id])) {
$amount = intval($_POST['amount'][$id]);
} else {
if(isset($_SESSION['amounts'][$id])) {
$amount = $_SESSION['amounts'][$id];
} else {
$amount = 1;
}
}
if(!isset($_SESSION['amounts'])) $_SESSION['amounts'] = array();
$_SESSION['amounts'][$id] = $amount;
I'm sorry but i kind of find some difficulties while editing my data , the problem is when i click the button edit, it works but when you go back to the previous page, it's like the id isn't stocked anymore so the array stays unknowns of this specific id.
Here is it's code:
<?php
include_once 'dbconfig.php';
$id = $_GET['quotauser'];
if (isset($id)) {
extract($crud->getQUOTA($id));
}
include_once 'headerQ.php';
?>
<div class="clearfix"></div>
<div class="container">
<a href="add-quota.php?add-quota" class="btn btn-large btn-info">
<i class="glyphicon glyphicon-plus"></i> Add Quota
</a>
</div>
<div class="clearfix"></div><br />
<div class="container">
<table class='table table-bordered table-responsive'>
<tr>
<th>id</th>
<th>QTANAME</th>
<th>SRVNAME</th>
<th>QTAVALUE</th>
<th colspan="3" align="center">Actions</th>
</tr>
<?php
$query = "SELECT quota.* FROM quota,user WHERE user.id=quota.id_user AND quota.id_user= '.$id.' ";
$records_per_page = 10;
$newquery = $crud->paging($query, $records_per_page);
$crud->quotaID($newquery);
?>
<tr>
<td colspan="10" align="center">
<div class="pagination-wrap">
<?php $crud->paginglink($query, $records_per_page); ?>
</div>
</td>
</tr>
</table>
</div>
<?php include_once 'footer.php'; ?>
and when the button show quota is clicked, the page that contains quota contain two options edit and delete
and the edit button takes u to this page
Edit's code is :
<?php
include_once 'dbconfig.php';
if (isset($_POST['btn-update'])) {
$id = $_GET['edit_quota'];
$QTANAME = $_POST['QTANAME'];
$SRVNAME = $_POST['SRVNAME'];
$QTAVALUE = $_POST['QTAVALUE'];
if ($crud->updateQ($id, $QTANAME, $SRVNAME, $QTAVALUE)) {
$msg = "<div class='alert alert-info'>
<strong>WOW!</strong> Quota was updated successfully <a href='UserQuota.php'>HOME</a>!
</div>";
} else {
$msg = "<div class='alert alert-warning'>
<strong>SORRY!</strong> ERROR while updating Quota !
</div>";
}
}
if (isset($_GET['edit_quota'])) {
$id = $_GET['edit_quota'];
extract($crud->getQUOTA($id));
}
?>
<?php include_once 'headerQ.php'; ?>
<div class="clearfix"></div>
<div class="container">
<?php
if (isset($msg)) {
echo $msg;
}
?>
</div>
<div class="clearfix"></div><br />
<div class="container">
<form method='post'>
<table class='table table-bordered'>
<tr>
<td>QTANAME</td>
<td><input type='text' name='QTANAME' class='form-control' value="<?php echo $QTANAME; ?>" required></td>
</tr>
<tr>
<td>SRVNAME</td>
<td><input type='text' name='SRVNAME' class='form-control' value="<?php echo $SRVNAME; ?>" required></td>
</tr>
<tr>
<td>QTAVALUE</td>
<td><input type='number' name='QTAVALUE' class='form-control' value="<?php echo $QTAVALUE; ?>" required></td>
</tr>
<tr>
<td colspan="2">
<button type="submit" class="btn btn-primary" name="btn-update">
<span class="glyphicon glyphicon-edit"></span> Update this Record
</button>
<i class="glyphicon glyphicon-backward"></i> CANCEL
</td>
</tr>
</table>
</form>
</div>
<?php include_once 'footer.php'; ?>
https://www.dropbox.com/s/e89hjxrogghll9a/1.jpg?dl=0
https://www.dropbox.com/s/sjqfsuwj9mlpc2o/2.jpg?dl=0
see the link above for the image. the image show the process
if i click my selected tables, it cannot select the correct data. here is my code. Thank you for the Help
<table id="example2" class="table table-bordered table-hover">
<thead>
<tr>
<th>Code</th>
<th>Date of Request</th>
<th>Requestor Name</th>
<th>Form Type</th>
<th>Request Type</th>
<th>Details</th>
<th>Date Needed</th>
<th>Action</th>
</tr>
</thead>
<?php
$req1 = mysql_query('select * from mainviewrequestor where username="'.$_SESSION['username'].'" and req_dateapprove IS NULL');
while($dn1 = mysql_fetch_array($req1))
{
?>
<tr>
<td><?php echo date($dn1['req_code']); ?></td>
<td><?php echo date($dn1['req_date']); ?></td>
<td class="left"><?php echo htmlentities($dn1['empname'], ENT_QUOTES, 'UTF-8'); ?></td>
<td><?php echo htmlentities($dn1['form_name'], ENT_QUOTES, 'UTF-8'); ?></td>
<td> <?php echo $dn1['itrf_type']?></td>
<td> <?php echo $dn1['itrf_details']?></td>
<td> <?php echo $dn1['req_dateneeded']?></td>
<td class="left"><button type="submit" class="btn btn-primary" name="approved">View</button>
<button type="submit" class="btn btn-primary" name="btn-sub2">DisApproved</button></td>
</tr>
<?php
}
if(intval(mysql_num_rows($req1))==0)
{
?>
<tr>
<td colspan="4" class="center">You have no unread message.</td>
</tr>
<?php
}
?>
</table>
<br />
<?php
}
?>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<?php
$req1 = mysql_query('select * from mainviewrequestor2');
while($dn1 = mysql_fetch_array($req1))
{
?>
<!--Pop-up modal Code-->
<div class = "modal fade" id="proceed" role="dialog">
<div class = "modal-dialog modal-lg">
<div class = "modal-content">
<div class = "modal-header">
<h4>REQUEST TABLES</h4>
<h2>------------------------------------------------------------------------------------------</h2>
<div class="content">
<form>
<label>Date Created: </label><input type="text" name="req_date" id="req_date" value="<?php echo ($dn1['req_date']); ?>" /><br />
<label>Request By: </label><input type="text" name="empname" id="empname" value="<?php echo ($dn1['empname']) ?>" /><br />
<label>Form Name: </label><input type="text" name="form_name" id="form_name" value="<?php echo $dn1['form_name']?>" /><br />
<label>Request Type: </label><input type="text" name="itrf_type" id="itrf_type" value="<?php echo $dn1['itrf_type']?>" /><br />
<label>Details: </label><input type="text" name="itrf_details" id="itrf_details" value="<?php echo $dn1['itrf_details']?>" /><br />
<label> Date Needed:</label><input type="text" name="req_dateneeded" id="req_dateneeded" value="<?php echo $dn1['req_dateneeded']?>" /><br />
<button type="submit" class="btn btn-primary" name="req_code">Approved</button>
<button type="submit" class="btn btn-primary" name="update2">Disapproved</button>
</form>
</div>
<?php
}
?>
You need to replace the #proceed id on each modal element, and h ref element, so that they correspond
For your table
<a href="#proceed-<?php echo $req1['id'];?>" data-toggle="modal">
For your modal
while($dn1 = mysql_fetch_array($req1))
{?>
<div class = "modal fade" id="proceed-<?php echo $dn1['id'];?>" role="dialog">
Although this is a rather ugly way of choosing to do things.
I would instead only create one modal, and pass the ID to an ajax function to load the said form. But thats just me, and thats a whole other topic.
But this should fix your issue.