Only one radio button value is inserted in php - php

I have a dynamic radio button that inserts a list of student attendance data
but only one student data is inserted. What am I doing wrong
When only the first student gets inserted. The rest of the students do not get inserted into the database
<div class="table">
<table class="table table-sm table-bordered mx-auto">
<tr>
<th>Student Name</th>
<th>Attendence Status</th>
</tr>
<tbody>
<?php
while ($row=mysqli_fetch_array($select)) {
$student_id=$row['student_id'];
$student_name=$row['student_lastname'].' '.$row['student_midname'].' '.$row['student_firstname'];
$link='student_images/'.$row['student_img'];
?>
<tr>
<td class="px-md-2" ><?php echo '<img src="'.$link.'" class="profile-user-img img-fluid img-circle" alt="Student Picture" />' ?>
<p class="profile-username lead"><?php echo $student_name; ?></p>
<p class="text-muted "><?php echo "Date:".' '.date("d/m/Y"); ?></p>
</td>
<td class="mx-auto" style="width: 40%;">
<div class="radio icheck-square">
<input type="radio" value="1" id="state" name="<?php echo $student_id; ?>" />
<label for="present">Present</label>
</div>
<div class="radio icheck-square">
<input type="radio" value="0" id="state" name="<?php echo $student_id; ?>" />
<label for="absent">Absent</label>
</div></td>
</tr>
<input type="hidden" name="student_id" id="student_id" value="<?php echo $student_id ?>">
<input type="hidden" name="date" id="date" value="<?php echo date("Y/m/d"); ?>">
<?php
}
?>
</tbody>
</table>
<div class="row">
<div class="col">
<button class="btn btn-primary" onclick="AddOnly();">Add Attendance Only</button>
or
<button class="btn btn-info" onclick="AddSend();">Add Attendance & Alert Parents</button>
</div>
</div>
</div>
</div>
The PHP code is that processes the data is below
$state=$_POST['state'],
$student_id=$_POST['student_id'];
$date=$_POST['date'];
$insert=mysqli_query($conn,"INSERT INTO `aza_attendance`(`attendance_id`, `student_id`, `atten_date`, `state`) VALUES (NULL, '$student_id', '$date', '$state')") or die(mysqli_error($conn));
if ($insert) {
if ($state==1) {
echo $student_id. 'was at school on'.' '.$date;
}else if($state==0){
echo $student_id. 'was at <strong>NOT</strong> school on'.' '.$date;
}
}

i think is not good to use a variable in name like you use here name="" i think this is better just put them in one div
<div class="radio icheck-square">
<input type="radio" value="1" id="state" name="state" />
<label for="present">Present</label>
<input type="radio" value="0" id="state" name="state" />
<label for="absent">Absent</label>
</div>

Related

how to display contents from another table (codeigniter)?

I want to do crud on my page and I have to get content from another table and display it in a select tag. my plan was to make an update page wherein it will get the data from another table to display (in this case the category_name, cat_id was the foreign key at the menu table).
I already tried to join because that's what other forums have said but I think I was wrong.
help would really be appreciated.
this is my model:
function inputMenuToUpdate($menu_id){
$this->db->select('cat_id, category.category_id, category.category_name AS category_name');
$this->db->from('menu');
$this->db->join('category', 'menu.cat_id = category.category_id');
$this->db->where('menu_id',$menu_id);
return $query->row();
}
this is my controller:
public function inputToUpdate($menu_id){
$data['row'] = $this->adminMenuModel->inputMenuToUpdate($menu_id);
$this->load->view('adminEdit', $data);
}
this is my view:
<tbody>
<!-- $result is from the $data in CrudController-->
<?php foreach($result as $row){?>
<tr>
<td><?php echo $row->menu_name; ?></td>
<td><?php echo $row->category_name; ?></td>
<td><?php echo $row->price; ?></td>
<td><?php echo $row->description; ?> </td>
<td>
<i class="fa fa-pencil"></i>
</td>
</tr>
<?php } ?>
</tbody>
and this is my update page:
<div class="container" style="width: 40rem;">
<form method="POST" action="<?php echo site_url('adminMenuController/update'); ?> / <?php echo $row->category_id; ?>">
<button type="button" class="btn btn-link"> Go Back </button>
<h1> UPDATE MENU </h1>
<div class="border-bottom"></div>
<br>
<br>
<label for="upMName">New Drink Name</label>
<input type="text" name="mn" class="form-control" id="upMName" value="<?php echo $row->menu_name ?>"></input>
<!-- <label for="cat"> Category </label>
<select id="cat" class="form-control">
<option> <?php echo $row->category_name; ?> </option>
</select> -->
<label for="upPrice">New Price</label>
<input type="number" name="price" class="form-control" id="upPrice" value="<?php echo $row->price ?>"> </input>
<label for="updesc">New Description </label>
<input type="text" name="desc" class="form-control" id="updesc" value="<?php echo $row->description ?>"> </input>
<br>
<button type="submit" class="btn btn-info"> Update </button>
<button type="reset" class="btn btn-danger"> Cancel </button>
</form>
</div>

Update data in table row [PHP]

I have a standard HTML table, each row in the table is generated from a database table using a loop.
At the end of each row I have an update button, I'd like this to update data in the table fields.
The image below shows the concept.
The table itself
<div class="container" id="users">
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<form method="post" action="">
<table class="table table-bordered table-hover table-striped tablesorter">
<thead>
<tr>
<th width="10%" style="text-align:left">Forename</th>
<th width="15%" style="text-align:left">Surname</th>
<th width="35%" style="text-align:left">Email</th>
<th width="30%" style="text-align:left">Permissions</th>
<th width="5%" style="text-align:left">Update</th>
<th width="5%" style="text-align:left">Delete</th>
</tr>
</thead>
<tbody>
<tr>
<!--here showing results in the table -->
<?php
$adminquery = "SELECT * FROM admin ORDER by user_id DESC";
$IDlist = mysqli_query($dbconEDB, $adminquery);
while($rowlist=mysqli_fetch_array($IDlist))//while look to fetch the result and store in a array $row.
{
$user_id = $rowlist["user_id"];
$admin_email = $rowlist["admin_email"];
$forename = $rowlist["forename"];
$surname = $rowlist["surname"];
$JPortal = $rowlist["JPortal"];
$Tenders = $rowlist["Tenders"];
$News= $rowlist["News"];
$Events = $rowlist["Events"];
$Users= $rowlist["Users="] ;
?>
<td style="text-align:left">
<div class="form-group">
<input name="user_id" id="user_id" type="text" class="form-control" value="<?php echo $user_id;?>">
<input name="forename" id="forename" type="text" class="form-control" value="<?php echo $forename;?>">
<div class="hidden"> <?php echo $forename;?></div>
</div>
</td>
<td style="text-align:left">
<div class="form-group">
<input name="forename" id="surname" type="text" class="form-control" value="<?php echo $surname;?>">
<div class="hidden"> <?php echo $surname;?></div>
</div>
</td>
<td style="text-align:center">
<div class="form-group">
<input name="admin_email" id="admin_email" type="text" class="form-control" value="<?php echo $admin_email;?>">
<div class="hidden"> <?php echo $admin_email;?></div>
</div>
</td>
<td style="text-align:center">
<label>
<input name="JPortal" type="checkbox" id="JPortal" value="1" <?php if ($JPortal == 1) echo "checked='checked'" ;?>> Jobs
</label>
<label>
<input type="checkbox" name="Tenders" value="1" id="Tenders" <?php if ($Tenders == 1) echo "checked='checked'" ;?>> News
</label>
<label>
<input type="checkbox" name="News" value="1" id="News" <?php if ($News == 1) echo "checked='checked'" ;?>> Tenders
</label>
<label>
<input type="checkbox" name="Events" value="1" id="Events" <?php if ($Events == 1) echo "checked='checked'" ;?>> Events
</label>
<label>
<input type="checkbox" name="Users" value="1" id="Users" <?php if ($Users == 1) echo "checked='checked'" ;?>> Users
</label>
</td>
<td style="text-align:center">
<input class="btn btn-newable " type="submit" value="Update" name="EDBsubmit">
</td>
<td style="text-align:center">
<button class="btn btn-newable">update2</button>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</form>
</div>
</div>
</div>
I'm thinking I've just had an off day and could of in fact wrapped the form around each row of the table.
An easy way to do this is to have a form in each TD containing the update button.
Just make this button a input[type=submit], then add a input[type=hidden] in this form containing the ID of you line row. Then, you could basically get the ID in $_POST.
Example :
<td class="actions">
<form method="post">
<input type="hidden" name="row_id" value="<?php echo $line['id']; ?>"/>
<input type="submit" value="Update"/>
</form>
</td>

how to send id with form in php

I have a Dynamic page (holidays.php), which comes data from id using get method like this in url holidays.php?id=1
the code is
include('header.php');
include('db.php');
$id = $_GET['id'];
$sql_hp = "select * from `holiday_package` where `id` ='$id'";
$res_hp = mysql_query($sql_hp);
$rec_hp = mysql_fetch_array($res_hp);
and I have a contact form in same page which client fills and send an email to admin.
<form action="holidays-form.php" method="post">
<!--<span class="success"><?php echo $smsg; ?></span>
<span class="fail"><?php echo $emsg; ?></span>-->
<h3>Book Package</h3>
<div class="form-group">
<div class="form-elements">
<label>Name</label>
<div class="form-item">
<input type="text" name="name" required="required">
</div>
</div>
</div>
<div class="form-group">
<div class="form-elements">
<label>Email ID</label>
<div class="form-item">
<input type="email" name="email" required="required">
</div>
</div>
</div>
<div class="form-group">
<div class="form-elements">
<label>Contact Number</label>
<div class="form-item">
<input type="text" name="mobile" required="required">
</div>
</div>
</div>
<div class="form-select-date">
<div class="form-elements">
<label>Select Travel Date</label>
<div class="form-item"><i class="awe-icon awe-icon-calendar"></i>
<input type="text" name="date" class="awe-calendar" value="Date" required="required">
</div>
</div>
</div>
<div class="form-select-date hide">
<div class="form-elements">
<label>Select Package</label>
<div class="form-item">
<input type="hidden" name="pkg_title" value="<?php echo $rec_hp['pkg_title'];?>">
</div>
</div>
</div>
<div class="form-group">
<div class="form-elements hide">
<label>Package Price</label>
<div class="form-item">
<input type="hidden" name="pkg_price" value="<?php echo $rec_hp['pkg_price'];?>" />
</div>
</div>
</div>
<div class="form-group" style="margin-top:-15px;">
<div class="form-elements">
<label>No. of Guest</label>
<div class="form-item">
<select name="adult" required>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
</div>
</div>
</div>
<div class="price"><em>Total Cost for this Package</em> <div class="amount" id="cost_dv">INR <?php echo $rec_hp['pkg_price'];?>/-</div></div>
<div class="form-submit">
<div class="add-to-cart">
<button type="submit">Send Query for Booking</button>
</div>
</div>
</form>
I am sending mail through holidays-form.php page, see the code below
<?php
$name = $_POST['name'];
$email = $_POST['email'];
$mobile = $_POST['mobile'];
$date = $_POST['date'];
$pkg_title = $_POST['pkg_title'];
$pkg_price = $_POST['pkg_price'];
$adult = $_POST['adult'];
$from = 'Company Name';
$to = "info#companyname.com";
$subject = "New Holiday Package Submission";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$message = '<html><body>
<table width="500" border="0" cellspacing="0" cellpadding="0" style="border:#ccc solid 1px;">
<tr>
<td width="151" height="30" style="background:#f3f3f3; padding-left:5px;">Name</td>
<td width="149" style="background:#f3f3f3; padding- right:5px;">'.$name.'</td>
</tr>
<tr>
<td height="30" style="padding-left:5px;">Email</td>
<td style="padding-right:5px;">'.$email.'</td>
</tr>
<tr>
<td height="30" style="background:#f3f3f3; padding-left:5px;">Mobile</td>
<td style="background:#f3f3f3; padding-right:5px;">'.$mobile.'</td>
</tr>
<tr>
<td height="30" style="padding-left:5px;">Date</td>
<td style="padding-right:5px;">'.$date.'</td>
</tr>
<tr>
<td height="30" style="background:#f3f3f3; padding-left:5px;">Package Name</td>
<td style="background:#f3f3f3; padding-right:5px;">'.$pkg_title.'</td>
</tr>
<tr>
<td height="30" style="padding-left:5px;">Package Price (adult) </td>
<td style="padding-right:5px;">'.$pkg_price.'</td>
</tr>
<tr>
<td height="30" style="background:#f3f3f3; padding-left:5px;">Package Price (child)</td>
<td style="background:#f3f3f3; padding-right:5px;">'.$adult.'</td>
</tr>
</table>
</body></html>';
$success = mail($to,$subject,$message,$headers);
if ($success == true) {
header("Location:holidays.php?s=mail sent");
}
else {
header("Location:holidays.php?s=error");
}
?>
I want to show success message in holidays.php and I have Written the code in form tag like this
<?php
$s = $_GET['s'];
if ($s=="mail sent") {
echo ('<span class="success">Thankyou! Your Package Has been Successfully Submitted!. We will Feedback you asap.</span>');
}
else if ($s=="error") {
echo ('<span class="fail">Sorry! Please ensure you have filled all fields Correctly.</span>');
}
but after submitting the form holidays.php page showing an error like ( Notice: Undefined index: id in C:\xampp\htdocs\tricky-traveler\holidays.php on line 4 ) with success message. so how can I store or send the $id value which I used in the top of the page.
Give a hidden <input /> field (if you are using GET method):
<input type="hidden" name="id" value="<?php echo $id; ?>" />
If you are using POST method, simply change your PHP as:
$id = $_POST['id'];
Or change your <form> tag to:
<form action="holidays-form.php?id=<?php echo $id; ?>" method="post">
You can use a hidden form field
<input type="hidden" name="pkg_price" value="<?php echo htmlentities($_REQUEST['id']);?>" />
And make sure that you change the $_GET to $_REQUEST when checking the $id, since you post the form (so it will appear in $_POST or $_GET).
<input type="hidden" name="id" value="<?php echo $id?>">
//and in php page get your id using
$id = $_GET['id'];
$sql_hp = "select * from `holiday_package` where `id` ='$id'";

Displaying information from a specific id from a while loop on a different page

I created an admin function to be able to display/add/edit products that are on my site. I am having no issues with adding and fetching/displaying what products are on my site.
Being able to see the current product I am trying to edit is where I am having difficulties. I am displaying the products that are in my database by fetching all of them through a while loop. I added an edit link that goes to editproducts.php.
The problem I am having is I am not sure how to get the product's data that I clicked on to display and fetch just that product_id's data.
The way I display all of the products
<table class="tableproduct">
<tr>
<th class="thproduct">Product ID</th>
<th class="thproduct">Product Name</th>
<th class="thproduct">Price</th>
<th class="thproduct">Category</th>
<th class="thproduct">Description</th>
<th class="thproduct"></th>
<th class="thproduct"></th>
</tr>
<?php
if(isset($_POST['product_id']) && is_numeric($_POST['product_id'])) {
mysqli_query($con, "DELETE FROM products WHERE product_id = ". $_POST['product_id'] ."")
or die("Could not DELETE: " . mysqli_error($con));
"Your product was successfully deleted.";
} else {Session::flash('addproduct', 'Your product was successfully deleted.');
}
if( $result ){
while($row = mysqli_fetch_assoc($result)) :
?>
<form method="POST" action="adminproducts.php">
<tr>
<td class="tdproduct"><?php echo $row['product_id']; ?> </td>
<td class="tdproduct"><?php echo $row['name']; ?> </td>
<td class="tdproduct"><?php echo $row['price']; ?> </td>
<td class="tdproduct"><?php echo $row['category']; ?> </td>
<td class="tdproduct"><?php echo $row['description']; ?> </td>
<td class="tdproduct"><a href='editproducts.php?product_id=<?php echo $row['product_id']; ?>'>EDIT</a></td>
<input type="hidden" name="product_id" value="<? echo $row['product_id']; ?>"/>
<td class="tdproduct"><input name="delete" type="submit" value="DELETE "/></td>
</tr>
</form>
<?php
endwhile;
}
?>
</table>
The page where I want to edit the product.
I tried the GET function and pulling the product_id. This does nothing. The name and price that I am trying to echo at the bottom of the code does not display anything other than the echoed string '$'.
<?php
$_GET['product_id'];
?>
<form action="" method="post">
<div class="field">
<label for="product_id">Product ID</label>
<input type="text" name="product_id" class="inputbar">
</div>
<div class="field">
<label for="name">Product Name</label>
<input type="text" class="inputbar" name="name">
</div>
<div class="field">
<label for="price">Price</label>
<input type="text" class="inputbar" name="price">
</div>
<div class="field">
<label for="category">Category</label>
<input type="text" class="inputbar" name="category">
</div>
<div class="field">
<label for="description">Description</label>
<input type="text" class="inputbar" name="description">
</div>
<input type="hidden" name="token" value="<?php echo Token::generate(); ?>">
<label for="signinButton">
<input type="submit" id="signinButton" value="Update">
</label>
</form>
<p><?php echo "<a href='./viewProduct.php?view_product=$id'>" . $product['name'] . "</a>"; ?></p>
<p> <?php echo "$" . $product['price']; ?> </p>
Is there something I'm not doing correctly or over-looking?

HTML Form not submitting all Data

Hey just having a bit of an odd issue, just looking to see if anyone can spot anything obvious here. I have a form that is submitting back to the same page, which is fine, however it is only submitting back the from "Select Group" to "Staff Member" and then the submit and hidden value and not the checkboxes in between. Just at a loss as to why. Let me know if any other details are needed.
Any help would be hugely appreicated!
<div class="maincontent">
<div class="maincontentinner">
<div class="row-fluid">
<div class="span6">
<div class="widgetbox">
<h4 class="widgettitle">Enter programme information</h4>
<div class="widgetcontent">
<?php
if(isset($_POST['submit_pressed']))
{
$Form_Group = $_POST['group'];
$Form_Date = $_POST['date'];
$Form_Start = $_POST['S_time'];
$Form_Finish = $_POST['F_time'];
$Form_Staff = $_POST['staff'];
$Form_Arts = $_POST['Arts'];
$Form_Media = $_POST['Media'];
$Form_Personal = $_POST['Personal_Development'];
$Form_Training = $_POST['Training_Support'];
$Form_Youth = $_POST['Youth_In_Action'];
$Form_After = $_POST['After_Schools'];
$Form_Peer = $_POST['Peer_Education'];
$Form_Drop = $_POST['Drop_In_Centre'];
$Form_Arranged = $_POST['One_To_One_Arranged'];
$Form_Casual = $_POST['One_To_One_Casual'];
$Form_Residential = $_POST['Residentials'];
$Form_Kayaking = $_POST['Kayaking'];
$Form_Bike = $_POST['Bike'];
$Form_HillWalking = $_POST['Hill_Walking'];
$Form_Multi = $_POST['Multi_Sports'];
foreach($_POST['members'] as $value)
{
echo 'Checked: '.$value.'';
}
}
?>
<form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset>
<p>
<label>Select Group</label>
<span class="field">
<select name="group" class="uniformselect">
<option value="">Choose One</option>
<?php
$query = mysql_query("SELECT * FROM `GROUP` ORDER BY Group_Name ASC");
//while loop through each of the rows
while ($row = mysql_fetch_array($query))
{
//set variables from the rows
$Group_ID = $row['Group_ID'];
$Group_Name = $row['Group_Name'];
?>
<option value="<?php echo $Group_ID; ?>"><?php echo "$Group_Name"; ?></option>
<?php
}
?>
</select>
</span> </p>
<div class="par">
<label>Date Picker</label>
<span class="field">
<input id="datepicker" type="date" name="date" class="input-small" />
</span> </div>
<div class="par">
<label>Start Time</label>
<div class="input-append bootstrap-timepicker">
<input id="timepicker1" type="time" class="input-small" name="S_time" />
<span class="add-on"><i class="iconfa-time"></i></span> </div>
</div>
<div class="par">
<label>Finish Time</label>
<div class="input-append bootstrap-timepicker">
<input id="timepicker1" type="time" class="input-small" name="F_time" />
<span class="add-on"><i class="iconfa-time"></i></span> </div>
</div>
<label>Staff Member</label>
<span class="field">
<select name="staff" class="uniformselect">
<option value="">Choose One</option>
<?php
$query = mysql_query("SELECT * FROM STAFF ORDER BY STAFF_FNAME ASC");
//while loop through each of the rows
while ($row = mysql_fetch_array($query))
{
//set variables from the rows
$Staff_ID = $row['Staff_ID'];
$Staff_FName = $row['Staff_FName'];
$Staff_SName = $row['Staff_SName'];
?>
<option value="<?php echo $Staff_ID; ?>"><?php echo "$Staff_FName $Staff_SName"; ?></option>
<?php
}
?>
</select>
</span> </p>
<br /><br />
<p>
<label></label>
<span class="field">
</span>
</p>
</div>
</div>
</div>
<div class="span6">
<div class="widgetbox">
<h4 class="widgettitle">Select applicable programme(s)</h4>
<div class="widgetcontent">
<span class="formwrapper">
<input type="checkbox" name="Media" />
Media <br />
<input type="checkbox" name="Arts" />
Arts <br />
<input type="checkbox" name="Personal_Development" />
Personal Development<br />
<input type="checkbox" name="Training_Support" />
Training Support <br />
<input type="checkbox" name="Youth_In_Action" />
Youth In Action <br />
<input type="checkbox" name="After_Schools" />
After Schools <br />
<input type="checkbox" name="Peer_Education" />
Peer Education <br />
<input type="checkbox" name="Drop_In_Centre" />
Drop In Centre <br />
<input type="checkbox" name="One_To_One_Arranged" />
One To One (Arranged)<br />
<input type="checkbox" name="One_To_One_Casual" />
One To One (Casual)<br />
<input type="checkbox" name="Residentials" />
Residentials <br />
<input type="checkbox" name="Kayaking" />
Kayaking <br />
<input type="checkbox" name="Bike" />
Bike <br />
<input type="checkbox" name="Hill_Walking" />
Hill Walking <br />
<input type="checkbox" name="Multi_Sports" />
Multi Sports <br />
</span>
</div>
</div>
</div>
</div>
<div class="widgetbox">
<h4 class="widgettitle">Enter participating members</h4>
<script type="text/javascript">
jQuery(document).ready(function(){
// dynamic table
jQuery('#dyntable').dataTable({
"sPaginationType": "full_numbers",
"aaSortingFixed": [[0,'asc']],
"fnDrawCallback": function(oSettings) {
jQuery.uniform.update();
}
});
jQuery('#dyntable2').dataTable( {
"bScrollInfinite": true,
"bScrollCollapse": true,
"sScrollY": "300px"
});
});
<table id="dyntable" class="table table-striped responsive">
<!--table table-bordered responsive
<colgroup>
<col class="con0" style="align: center;/>
<col class="con1" />
<col class="con0" />
<col class="con1" />
<col class="con0" />
<col class="con1" />
<col class="con0" />
<col class="con1" />
<col class="con0" />
<col class="con1" />
<col class="con0" />
<col class="con1" />
<col class="con0" />
<col class="con1" />
</colgroup>-->
<thead>
<tr>
<th class="head0 nosort"><input type="checkbox" class="checkall" /></th>
<th class="head0">M-ID</th>
<th class="head1">Name</th>
<th class="head0">Surname</th>
<th class="head1">Gender</th>
<th class="head0">Address</th>
<th class="head1">Postcode</th>
<th class="head0">Contact</th>
<th class="head1">Email</th>
<th class="head0">MedCon</th>
</tr>
</thead>
<tbody>
<?php
//set up the query
$query = mysql_query("SELECT * FROM MEMBER ORDER BY MEMBER_FNAME ASC");
//while loop through each of the rows
while ($row = mysql_fetch_array($query))
{
//set variables from the rows
$Member_ID=$row['Member_ID'];
$Member_FName=$row['Member_FName'];
$Member_SName=$row['Member_SName'];
$Member_Gender=$row['Member_Gender'];
$Member_Address=$row['Member_Address'];
$Member_Postcode=$row['Member_Postcode'];
$Member_ContactNo=$row['Member_ContactNo'];
$Member_Email=$row['Member_Email'];
$Member_Medcon=$row['Member_MedCon'];
?>
<td class="aligncenter">
<span class="center">
<input type="checkbox" name="members[]" value="<?php echo "$Member_ID"; ?>" />
</span>
</td>
<td><?php echo $Member_ID ?></td>
<td><?php echo $Member_FName ?></td>
<td><?php echo $Member_SName ?></td>
<td><?php echo $Member_Gender ?></td>
<td><?php echo $Member_Address ?></td>
<td><?php echo $Member_Postcode ?></td>
<td><?php echo $Member_ContactNo ?></td>
<td><?php echo $Member_Email ?></td>
<td><?php echo $Member_Medcon ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<br />
<div align="right">
<input type="hidden" value="TRUE" name="submit_pressed">
<input type="submit" name="submit" value="Submit" class="btn btn-primary">
</div>
</fieldset>
</form>
You have your checkboxes set up wrong. Should be something like this:
<input type="checkbox" name="programs[]" value="Media" />
So when the user selects multiple checkboxes they will be put into $_POST[ 'programs' ] rather than trying to access each one individually.

Categories