Foreach loop on array of array indexes php - php

On the first page there is a form with a jquery script to add days.
If I just use one day I cant get all the info I need.
But when I add multiple days I just get the last entry.
I am trying to see every day of the event I book in the table on the next page book_gear.php.
But so far I am only see one day of the event .
I think it is because my foreach loop is going thought the array indexs rather than each event in the array.
book_avail.php
<?php require_once('../Include/initialize.php'); ?>
<!doctype html>
<html>
<!--Sets page title in browser-->
<?php $page_title = 'Schedule'; ?>
<!-- Imports header file with necessary scripts -->
<?php include ('../Include/header.php'); ?>
<!-- Imports Top navigation bar -->
<?php include ('../Include/navibar.php'); ?>
<!-- Imports javascript file to allow arrange by column -->
<?php include_once ('../Include/sort_by.php'); ?>
<?php include_once ('../Include/mysql_queries.php');
//loads all classes
include_once ('../Include/class-autoload.inc.php'); ?>
<script>
$(document).ready(function() {
var i = 1;
$("#add_row").click(function() {
$('tr').find('input').prop('disabled',true)
$('#addr' + i).html("<td>" + (i + 1) +
"</td><td><input type='text' value='Day" + (i + 1) +"' name='event[" + i + "][eventNameInitialQuery]' class='form-control input-md'/></td>\n\
<td><input type='date' name='event[" + i + "][dateFromIntialQuery]' placeholder='date' class='form-control' /></td>\n\
<td><input type='time' name='event[" + i + "][timeFromIntialQuery]' placeholder='time' class='form-control' /></td>\n\
<td><input type='date' name='event[" + i + "][dateToIntialQuery]' placeholder='date' class='form-control' />\n\</td>\n\
<td><input type='time' name='event[" + i + "][timeToIntialQuery]' placeholder='time' class='form-control' />\n\</td>");
$('#tab_logic').append('<tr id="addr' + (i + 1) + '"></tr>');
i++;
});
});
</script>
<script src="https://code.jquery.com/jquery-3.2.1.js"></script>
<?php
//sets user location or builing
if (isset($_SESSION['location'])) {
$userLocation = $_SESSION['location']?? '';}
$build_set = build_dropdown($userLocation);
?>
<!--Main Id is the bulk of the page-->
<div id="main">
<!--Sets side navigation bar-->
<div class="sidenav">
<div>
<!--Includes side navigation script -->
<?php include_once ('../Include/side_navi_login.php'); ?>
</div>
</div>
<br><br>
<body>
<!--Sets Title "Schedule Event"-->
<h1 class="book_event_title">Schedule Event</h1>
<!--This table is the form that runs along the top of the page-->
<div class="container">
<div class="row clearfix">
<div class="col-md-12 column">
<form action="book_gear.php?" method="post">
<table class="table table-bordered table-hover" id="tab_logic">
<thead>
<tr>
<th class="text-center">
Day
</th>
<th class="text-center">
Event Name
</th>
<th class="text-center">
Date From
</th>
<th class="text-center">
Time From
</th>
<th class="text-center">
Date To
</th>
<th class="text-center">
Time To
</th>
<th class="text-center">
Building
</th>
<th class="text-center">
VP Present
</th>
<th class="text-center">
Ticket
</th>
</tr>
</thead>
<tbody>
<tr id='addr0'>
<td>
1
</td>
<td>
<input type="text" name='event[0][eventNameInitialQuery]' placeholder='Event Name' class="form-control" />
</td>
<td>
<input type="date" name='event[0][dateFromIntialQuery]' placeholder='date' class="form-control" />
</td>
<td>
<input type="time" name='event[0][timeFromIntialQuery]' placeholder='time' class="form-control" />
</td>
<td>
<input type="date" name='event[0][dateToIntialQuery]' placeholder='date' class="form-control" />
</td>
<td>
<input type="time" name='event[0][timeToIntialQuery]' placeholder='time' class="form-control" />
</td>
<!-- Gets the dropdown menu from a method in the site view class -->
<td>
<select name="buildingCodeIntialQuery" id="site_value" required>
<option value="" disabled selected>-Building-</option>
<?php
$buildList = new SiteView;
$buildList->showMyBuildings($userLocation) ;
?>
</select>
</td>
<td>
<input type="hidden" name="vpInitialQuery" value="No" class="form-control"/>
<input type="checkbox" name="vpInitialQuery" value="Yes" class="form-control"/>
</td>
<td>
<input type="text" name='ticketInitialQuery' placeholder='Link to Event Ticket' class="form-control" />
</td>
</tr>
<tr id='addr1'></tr>
</tbody>
</table>
<div align="right" id="schedule_button">
<input type="submit" value="Schedule Event"/>
</div>
</form>
</div>
</div>
<button id="add_row" class="btn btn-primary btn-lg pull-left">Add Day</button>
</div>
</div>
</body>
<!--Includes bottom footer-->
<?php include('../Include/footer.php'); ?>
</html>
book_gear.php
<?php require_once('../Include/initialize.php'); ?>
<!doctype html>
<html>
<!--Sets page title in browser-->
<?php $page_title = 'Schedule'; ?>
<!-- Imports header file with necessary scripts -->
<?php include ('../Include/header.php'); ?>
<!-- Imports Top navigation bar -->
<!-- Imports javascript file to allow arrange by column -->
<?php include_once ('../Include/sort_by.php');
include_once ('../Include/mysql_queries.php'); ?>
<?php
//once the person is logged in their site is stored in this variable
if(isset($_SESSION['logins'])) {
$users_site = $_SESSION['location'];
}
if(isset($_POST['event'])) {
$events = $_POST['event'];
}
foreach($events as $unique =>$event){
?>
<table>
<tr>
<th>event name</th>
<th>datefrom</th>
<th>timefrom</th>
<th>dateto</th>
<th>timeto</th>
</tr>
<td><?php echo $event['eventNameInitialQuery'];?></td>
<td><?php echo $event['dateFromIntialQuery'];?></td>
<td><?php echo $event['timeFromIntialQuery'];?></td>
<td><?php echo $event['dateToIntialQuery'];?></td>
<td><?php echo $event['timeToIntialQuery'];?></td>
</table><?php ;}?>
EDIT
After suggested in the comments ran
echo '<pre>'; var_dump($events);echo '</pre>';die(); before the foreach loop
Result
array(1) {
[1]=>
array(5) {
["eventNameInitialQuery"]=>
string(4) "Day2"
["dateFromIntialQuery"]=>
string(10) "2020-07-23"
["timeFromIntialQuery"]=>
string(5) "18:57"
["dateToIntialQuery"]=>
string(10) "2020-07-11"
["timeToIntialQuery"]=>
string(5) "19:54"
}
}

I've done a quick test and the problem is with disabling the earlier inputs when adding a new event row. What you could do is copy the values of your inputs to hidden inputs before you disable them.

Related

when i do form the popup window displays in just a second then hide again

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>

Get class element

I make Jquery to read data from db and when I click the list it shown roe data on detail box.
But.... problem: I make div where I show content. I load page with Jquery to div.
but when I do this the row click dont work. I can not understan why. It is shild element but id i understan right when I use getElementById it should to take current row, but no.
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php include './config/init.php'; ?>
<html>
<head>
<meta charset="UTF-8">
<title>Biisilista</title>
<script src="./js/jquery-3.2.1.js"></script>
<link href="css/basic.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>KaraokeBiisit </h1>
<div id="edit" style="display:none">
<div>
<form name="formedit" method="post" action="">
<table id="edittable" border="1" cellspacing="2" cellpadding="1">
<tbody>
<tr>
<td>
<label>Nimi:</label>
</td>
<td>
<input id="nimi" name="nimi" placeholder="Kappaleen nimi" type="text">
</td>
<td>
<label>Levy:</label>
</td>
<td>
<input id="levy" name="levy" placeholder="Levyn tunnus" type="text" width="10px">
</td>
</tr>
<tr>
<td>
<label>Artisti:</label>
</td>
<td>
<input id="artisti" name="artisti" placeholder="Kappaleen esittäjä" type="text">
</td>
<td>
<label>Kieli:</label>
</td>
<td>
<input id="kieli" name="kieli" placeholder="Alkuperäiskieli" type="text" width="20">
</td>
</tr>
<tr>
<td>
<label>Numero:</label>
</td>
<td>
<input id="numero" name="numeron" placeholder="Numero" type="text">
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
<div id="pageContent">
</div>
<script src="./js/jquery-3.2.1.js"></script>
<script src="./js/script.js"></script>
</body>
</html>
jQuery(document).ready(function ($) {
$("#pageContent").click(function () {
$('tr').removeClass('selected');
$(this).addClass('selected');
var selectedRow;
selectedRow = $(rivi);
var td = $(selectedRow).children('td');
$('#nimi').val(td[0].innerText);
$('#artisti').val(td[1].innerText);
$('#levy').val(td[2].innerText);
$('#kieli').val(td[3].innerText);
$('#numero').val(td[4].innerText);
console.log("test");
});
$(".clickable-row").on('click', () => {
$('#edit').show();
});
$('#pageContent').load('container.php');
// $('#pageContent').load('biisit.php');
});
function showBiisit() {
console.log("Näytetään sisältö");
$('#pageContent').load('container.php');
}
<?php include './config/init.php'; ?>
<?php
//luodaan tietokantaobjekti
$db = new DataBase();
// tehdään kysely
$db->query("SELECT * FROM kappaleet");
//query("SELECT `id`,`nimi`,`artisti`,`levy`,`kieli`,`numero` FROM `kappaleet`;");
//yhdistetään hakutulokseen
$kappaleet = $db->resultset();
?>
<table id="dataTable">
<tr>
<th>Nimi</th>
<th>Artisti</th>
<th width="100" align="left">Levy</th>
<th width="100" align="left">Kieli</th>
<th width="100" align="left">Numero</th>
</tr>
<?php foreach ($kappaleet as $biisi): ?>
<tr class='clickable-row' >
<td><?php echo $biisi->nimi ?></td>
<td><?php echo $biisi->artisti ?></td>
<td><?php echo $biisi->levy ?></td>
<td><?php echo $biisi->kieli ?></td>
<td><?php echo $biisi->numero ?></td>
</tr>
<?php endforeach; ?>
</table>
try this
...
$("body").on('click', '.clickable-row', function () { //i change this line
$('tr').removeClass('selected');
$(this).addClass('selected');
var selectedRow = $(this);
//selectedRow = $(rivi); idk what is this
var td = selectedRow.children('td');
$('#nimi').val(td[0].innerText);
$('#artisti').val(td[1].innerText);
$('#levy').val(td[2].innerText);
$('#kieli').val(td[3].innerText);
$('#numero').val(td[4].innerText);
console.log("test");
});
...

How to submit multiple rows tabular form data in database using code igniter?

Hello i am creating a school management system and facing a little problem.
The problem is that i am having a complex form containing following fields in a table
I have a table fee structure in which i want to insert data.
having columns
id | classID | sectionID | feetypeID | must | amount | active
1 1 1 1 must 500 yes
2 1 1 2 optional 500 no
so how to create an array such that it uses above form to insert data in table.
Basically i want users to choose feetype they want to have for classes and set their amount and then choose classes they want to apply it for so an entry is created in database for each section and each feetype they select.
I don't know how to make controller and model for this but i have this code of view
View
<form class="form-horizontal" role="form" method="post">
<div class="box-body">
<div class="row">
<div class="col-sm-12">
<h3>Fee Types</h3><br>
<div id="hide-table">
<table id="example1" class="table table-striped table-bordered table-hover dataTable no-footer">
<thead>
<tr>
<th class="col-sm-2"><?=$this->lang->line('slno')?></th>
<th class="col-sm-2"><?=$this->lang->line('feetype')?></th>
<th class="col-sm-2"><?=$this->lang->line('amount')?></th>
<th class="col-sm-2"><?=$this->lang->line('must')?></th>
<th class="col-sm-2"><?=$this->lang->line('active')?></th>
<th class="col-sm-2"><input type="checkbox"> Select All</th>
</tr>
</thead>
<tbody>
<?php if(count($feetypes)) {$i = 1; foreach($feetypes as $feetype) { ?>
<tr>
<td data-title="<?=$this->lang->line('slno')?>">
<?php echo $i; ?>
</td>
<td data-title="<?=$this->lang->line('feetype_name')?>" name="feetypeID" value="<?php echo $feetype->feetypeID;?>">
<?php echo $feetype->feetype; ?>
</td>
<td data-title="<?=$this->lang->line('amount')?>" name="amount">
<input type="text" class="form-control" value="<?php echo $feetype->defaultamount; ?>">
</td>
<td data-title="<?=$this->lang->line('must')?>">
<select class="form-control" name="must">
<option value="MUST">Must</option>
<option value="OPTIONAL">Optional</option>
</select>
</td>
<td data-title="<?=$this->lang->line('active')?>">
<select class="form-control" name="active">
<option value="1">Yes</option>
<option value="0">No</option>
</select>
</td>
<td data-title="<?=$this->lang->line('select')?>">
<input type="checkbox" name="selected">
</td>
</tr>
<?php $i++; }} ?>
</tbody>
</table>
</div>
<div class="row">
<div class="col-sm-8">
<h3> Apply To</h3><br>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<table class="table table-bordered table-striped">
<thead>
<th class="col-sm-3">Class</th>
<th class="col-sm-4">Section</th>
</thead>
<tbody>
<?php
foreach ($categories as $category)
{
?>
<tr>
<td> <input type="checkbox"><span style="font-size:18px;margin-left:10px;"> <?php echo $category->classes; ?></span>
</td>
<td>
<?php
if(!empty($category->subs)) {
foreach ($category->subs as $sub) {
echo "<input type='checkbox'> ".$sub->section.' ' ;
}
}
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
<br><br>
<div class="form-group">
<div class="col-sm-12">
<input type="submit" class="btn btn-success" value="<?=$this->lang->line("add_feestructure")?>" >
</div>
</div>
</div>
</form>
Controller
public function addfeestructure(){
$usertype = $this->session->userdata("usertype");
if($usertype == "Admin" || $usertype == "Accountant"){
$this->data['categories'] = $this->feestructure_m->get_categories();
$this->data['feetypes'] = $this->feestructure_m->get_feetypes();
if($_POST){
}
$this->data['subview'] = "feestructure/addfeestructure";
$this->load->view('_layout_main', $this->data);
}
}
To submit multiple fields of the same name you need to add square brackets to your the name attribute like this; <input type="text" name="fieldName[]">.
Then in your controller you'll use a foreach loop to process the form:
public function submitForm() {
$fieldA = $this->input->post('fieldName'); // this will be an array
for ($i = 0; $i < sizeof($fieldA); $i++) {
$array = array('fieldA' => $fieldA[$i]);
$this->your_model->addRecordToDatabase($tableName, $array);
}
}

Show only relevant search results

I have created a page for search, and I'm having some problems.
The data is displayed on the page but I also use some fields on the form for a specific field, so when I enter the data in those fields and hit search, it shows the search field on the top of the display page with the rest of the data, but I want only the data which belongs to my search.
CODE:
<?php
include('connect.php');
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include('include/head.php')?>
</head>
<body>
<div id="header-wrapper">
<div id="header">
<div id="menu">
<ul>
<?php include('include/menu.php') ?>
Logout
</ul>
</div>
</div>
</div>
<div id="logo">
<?php include('include/logo.php'); ?>
</div>
<div id="wrapper">
<div id="page">
<div id="page-bgtop">
<div id="content">
<div class="post">
<div class="entry-image">
<?php
$q=mysql_query("SELECT count( php ) AS ph, count( dotnet ) AS dot, count( design ) AS des FROM candidate");
while($row=mysql_fetch_array($q))
{
?>
<form name="" method="post">
<table border="1" cellpadding="10" cellspacing="1" width="280" height="200">
<th colspan="5" bgcolor="orange" >Total Number of Resume by skills</th>
<tr>
<th><B>PHP</B></th>
<th><B>DOTNET</B></th>
<th><B>DESIGN</B></th>
</tr>
<td><?php echo "$row[ph]"; ?></td>
<td><?php echo "$row[dot]"; ?></td>
<td><?php echo "$row[des]"; ?></td>
</table>
</form>
<?php
}
?>
</div>
<h2 class="title">Welcome to Resume </h2>
<div class="entry">
<p>
<form name="search" method="post" action="searchview.php">
<table>
<tr>
Id: <input type="text" name="id" /></br></br>
Name:<input type="text" name="name" /><br/></br>
Expected Salary:<input type="text" name="es" /><br/></br>
Skill Rate: <input type="text" name="sr" /><br/> </br>
Salary:<input type="text" name="cs" /></br></br>
<input type="submit" name="submit" value="seach" /><input type="reset" name="reset" value="reset" />
</tr>
</table>
</form>
</p>
</div>
</div>
<div class="post" >
<?php
$query=mysql_query("select * from candidate");
while($row=mysql_fetch_array($query))
{
$sno=$row['id'];
$image=$row['image'];
$name=$row['fname'];
$es=$row['es'];
$sr=$row['sr'];
$cs=$row['cs'];
?>
<form name="view" method="post" action="searchview.php" >
<table border="1" cellpadding="30" class="centered" width="20" >
<tr>
<th width="150">S.NO</th>
<th width="150">IMAGE</th>
<th width="150">NAME</th>
<th width="150">EXPECTED SALARY</th>
<th width="150">SKILL RATE</th>
<th width="150">SALARY</th>
<th width="150">ACTION</th>
</tr>
<td><?php echo "$row[id]"; ?></td>
<td><div class="rightdiv1a"><img src="<?php echo 'img/'.$row['image']; ?>" style="height:120px; width:145px; "></div></td>
<td><?php echo "$row[fname]"; ?></td>
<td><?php echo "$row[es]"; ?></td>
<td><?php echo "$row[sr]"; ?></td>
<td><?php echo "$row[cs]"; ?></td>
<td><img alt='view' title='view' src='images/view.png' width='15px' height='15px' hspace='20' /></td>
<td><img alt='Edit' title='Edit' src='images/edit.png' width='15px' height='15px' hspace='20' /></td>
<td><a onclick="return confirm('Would you like to delete?');" href="delete.php?id=<?php echo "$row[id]"; ?>"><img alt='delete' title='delete' src='images/delete.png' width='15px' height='15px' hspace='20' /></a></td>
</table>
</form>
<?php
}?>
</div>
</div>
</div>
</div>
</div>
<div id="footer-bgcontent">
<div id="footer">
<?php// include('include/footer.php');?>
</div>
</div>
</body>
</html>
<?php// } ?>
This code displays the data now but I want to filter the data and only show the results which belongs to my search, and have the rest disappear.
Here are some screenshots of my form:
pls help,
thanks in advance..
If I understand the question correctly, you want to display the search results, but no longer show the search form. If this is the case, then move your second "post" div to the top and wrap it in an if:
if (!empty($_POST)) {
// Process POST results here:
...
die(); // end processing so the form doesn't display again
}

Getting Correct value of ID and Populate to Modal Popup

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.

Categories