php repeat one value twice in the while loop (if possible) - php

I have this table:
emailtype:
emailtypeID emailtype
1 primary
2 secondary
3 old
I have this code to show emails in the input form:
$sql = "SELECT * from emailtype";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()) {
echo 'Email <input type="hidden" name="emailtype[]" id="" value="' . $row["emailtypeID"] . '"/>' . $row["emailtype"];
echo '<input type="text" name="email[]" id="" /><br />'; }
GOAL:
I would like to repeat twice the emailtypeID = 2 or emailtype = secondary, so that I can enter two email addresses with the secondary ID.
Is it possible in the while loop?
Thanks!
SOLUTION:
For anybody who needs it, this is the new code as per the Marc B suggestion.
while($row = $result->fetch_assoc()) {
echo 'Email <input type="hidden" name="emailtype[]" id="" value="' . $row["emailtypeID"] . '"/>' . $row["emailtype"];
echo '<input type="text" name="email[]" id="" /><br />';
if($row["emailtype"] == 'secondario'){
echo 'Email <input type="hidden" name="emailtype[]" id="" value="' . $row["emailtypeID"] . '"/>' . $row["emailtype"];
echo '<input type="text" name="email[]" id="" /><br />';
}
}

Please use this:
while($row = $result->fetch_assoc()) {
echo 'Email <input type="hidden" name="emailtype[]" id="" value="' . $row["emailtypeID"] . '"/>' . $row["emailtype"];
echo '<input type="text" name="email[]" id="" /><br />';
if($row["emailtype"] == 'secondario' || $row["emailtypeID"]==2){
echo 'Email <input type="hidden" name="emailtype[]" id="" value="' . $row["emailtypeID"] . '"/>' . $row["emailtype"];
echo '<input type="text" name="email[]" id="" /><br />';
}
}

Related

Edit User page in PHP and PHPMYSQL using Array Drop Down Selection

I would like to ask why every time i try to call programme it doesn't show the results? I'm trying to create edit user page which means i will call back the database but mine doesn't show up.
Here's my Edit User code i have problem with row4
// Retrieve the user's information:
$q = "SELECT first_name, last_name, phone, email , programme FROM users WHERE user_id=$id";
$r = #mysql_query ($q);
if (mysql_num_rows($r) == 1) { // Valid user ID, show the form.
// Get the user's information:
$row = mysql_fetch_array ($r, MYSQL_NUM);
// Create the form:
echo '<div align="center"/div><form action="edit_user.php" method="post">
<p>First Name: <input type="text" name="first_name" size="15" maxlength="15" value="' . $row[0] . '" /></p>
<p>Last Name: <input type="text" name="last_name" size="15" maxlength="30" value="' . $row[1] . '" /></p>
<p>Phone No: <input type="text" name="phone" size="20" maxlength="60" value="' . $row[2] . '" /> </p>
<p>Email Address: <input type="text" name="email" size="20" maxlength="60" value="' . $row[3] . '" /> </p>
<p>Programme: <name="programme" size="20" maxlength="60" value="' . $row[4] . '" /> </p>
<p><input type="submit" name="submit" value="Submit" /></p>
<input type="hidden" name="id" value="' . $id . '" />
</form>';
Here's my Registration code because i used drop down so i can't call drop down back in edit user page that include database for programme registered
<?php # Script 3.5 - Registration Form
$page_title = 'Registration Form';
include ('./includes_css/header.html');
?>
<div align="center"><h2>Registration Form</h2>
<form action="register.php" method="post">
<legend>Enter your information in the form below:</legend><br/>
<p><b>First Name:</b> <input type="text" size="21" name="first_name" value="<?php if (isset($_POST['first_name'])) echo $_POST['first_name']; ?>"/></p>
<p><b>Last Name:</b> <input type="text" size="21"name="last_name" value="<?php if (isset($_POST['last_name'])) echo $_POST['last_name']; ?>"/></p>
<p><b>Phone No:</b> <input type="text" size="22"name="phone" value="<?php if (isset($_POST['phone'])) echo $_POST['phone']; ?>"/></p>
<p><b>Email Address:</b> <input type="text" size="18"name="email" /value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>"/></p>
<p><b>Programme:</b> <name="programme" value="<?php if (isset($_POST['programme'])) echo $_POST['programme']; ?>"/>
<?php
$programme = array ('null' => 'SELECT','BIMD', 'BSE', 'BCEM', 'BCA', 'DIM', 'DCNET',
'DIT', 'DIA');
// Make the programme pull-down menu.
echo '<select name="programme">';
foreach ($programme as $key => $value) {
echo "<option value=\"$value\">$value</option>\n";
}
echo '</select>';
?>
<div align="center"><input type="submit" name="submit" value="Register" /></div>
<input type="hidden" name="submitted" value="TRUE" />
</form>
I have problem with Edit User page (Program doesn't show up).

Undefined offset notice with array within foreach loop

i have a form.php with an array posting to update.php to update a mysql db.
The relevant parts of each are:
form.php
if ($type == "1") {echo '
<input type="hidden" id="assettype" name="atype[]" value="'. $row['AType'] .'"/>
<input type="hidden" id="assetid" name="aid[]" value="'. $row['AID'] .'"/>
<input type="text" name="serialnum[]" value="'. $row['SerialNumber'] .'"/>
<input type="text" name="unitsize[]" value="'. $row['UnitSize'] .'"/>
<input type="text" name="prop1[]" value="'. $row['Prop1'] .'"/>
<input type="text" name="latitude[]" value="'. $row['Latitude'] .'"/>
<input type="text" name="longitude[]" value="'. $row['Longitude'] .'"/>
';}
if ($type == "2") {echo '
<input type="hidden" id="assettype" name="atype[]" value="'. $row['AType'] .'"/>
<input type="hidden" id="assetid" name="aid[]" value="'. $row['AID'] .'"/>
<input type="text" name="serialnum[]" value="'. $row['SerialNumber'] .'"/>
<input type="text" name="unitsize[]" value="'. $row['UnitSize'] .'"/>
<input type="text" name="prop2[]" value="'. $row['Prop2'] .'"/>
<input type="text" name="latitude[]" value="'. $row['Latitude'] .'"/>
<input type="text" name="longitude[]" value="'. $row['Longitude'] .'"/>
';}
Update.php
foreach ($_POST['aid'] as $key=>$assetid) {
$atype = $_POST['atype'][$key];
if ($atype == "1") {
$stmt = $mysqli->stmt_init();
$query = "UPDATE asset SET
SerialNumber=?,UnitSize=?,Prop1=?,Latitude=?,Longitude=? WHERE AID = ?";
if($stmt->prepare($query)) {
$stmt->bind_param('sdddds', $serialnum, $unitsize, $prop1, $lat, $long, $assetid);
$assetid = $_POST['aid'][$key];
$serialnum = $_POST['serialnum'][$key];
$unitsize = $_POST['unitsize'][$key];
$prop1 = $_POST['prop1'][$key];
$lat = $_POST['latitude'][$key];
$long = $_POST['longitude'][$key];
$stmt->execute();
$stmt->close();
}
}
elseif ($atype == "2") {
$stmt = $mysqli->stmt_init();
$query = "UPDATE asset SET
SerialNumber=?,Prop2=?, Latitude=?,Longitude=? WHERE AID = ?";
if($stmt->prepare($query)) {
$stmt->bind_param('ssdds', $serialnum, $prop2, $lat, $long, $assetid);
$assetid = $_POST['aid'][$key];
$serialnum = $_POST['serialnum'][$key];
$prop2 = $_POST['prop2'][$key];
$lat = $_POST['latitude'][$key];
$long = $_POST['longitude'][$key];
$stmt->execute();
$stmt->close();
}
}}
This works great for all but one of the inputs in the array.
I keep getting the following:
Notice: Undefined offset: 3
relating to the following line:
$prop2 = $_POST['prop2'][$key];
All the other DB fields are updating fine except for this one. Can anyone point me in the right direction please?
You should use same name for this array input field. ie prop[] , but you used prop1[] and prop2[].
if ($type == "1") {echo '
<input type="hidden" id="assettype" name="atype[]" value="'. $row['AType'] .'"/>
<input type="hidden" id="assetid" name="aid[]" value="'. $row['AID'] .'"/>
<input type="text" name="serialnum[]" value="'. $row['SerialNumber'] .'"/>
<input type="text" name="unitsize[]" value="'. $row['UnitSize'] .'"/>
<input type="text" name="prop[]" value="'. $row['Prop1'] .'"/>
<input type="text" name="latitude[]" value="'. $row['Latitude'] .'"/>
<input type="text" name="longitude[]" value="'. $row['Longitude'] .'"/>
';}
if ($type == "2") {echo '
<input type="hidden" id="assettype" name="atype[]" value="'. $row['AType'] .'"/>
<input type="hidden" id="assetid" name="aid[]" value="'. $row['AID'] .'"/>
<input type="text" name="serialnum[]" value="'. $row['SerialNumber'] .'"/>
<input type="text" name="unitsize[]" value="'. $row['UnitSize'] .'"/>
<input type="text" name="prop[]" value="'. $row['Prop2'] .'"/>
<input type="text" name="latitude[]" value="'. $row['Latitude'] .'"/>
<input type="text" name="longitude[]" value="'. $row['Longitude'] .'"/>
';}
And in action page update like this:
$prop2 = $_POST['prop'][$key];
I don't know what logic you used, If there is a logical error use,
$prop2 = !empty($_POST['prop2'][$key]) ? $_POST['prop2'][$key] : '';

Hash Secure not working in MIGS payment

I have implemented MIGS payment service in my magento installation and it is using a vpc_php_serverhost_do.php. These are the values Im passing to that file
<input type="hidden" name="virtualPaymentClientURL" size="63" value="https://migs.mastercard.com.au/vpcpay" maxlength="250">
<input type="hidden" name="vpc_Version" value="1" size="20" maxlength="8">
<input type="hidden" name="vpc_Command" value="pay" size="20" maxlength="16">
<input type="hidden" name="vpc_MerchTxnRef" value="<?php echo $orderId; ?>" size="20" maxlength="40">
<input type="hidden" name="vpc_AccessCode" value="<?php echo $access_code; ?>" size="20" maxlength="8">
<input type="hidden" name="vpc_Merchant" value="<?php echo $merchant; ?>" size="20" maxlength="16">
<input type="hidden" name="vpc_OrderInfo" value="<?php echo $orderId; ?>" size="20" maxlength="34">
<input type="hidden" name="vpc_Amount" value="<?php echo $amountInFils; ?>" size="20" maxlength="10">
<input type="hidden" name="vpc_Locale" value="en" size="20" maxlength="5">
<input type="hidden" name="vpc_ReturnURL" size="63" value="<?php echo $url;?>" maxlength="350">
<input type="hidden" name="vpc_user_SessionId" size="63" value="<?php echo $sessionId;?>" maxlength="350">
I have give secure secret provided by the client and the rest of the code looks like the one below
$vpcURL = $_POST["virtualPaymentClientURL"] . "?";
unset($_POST["virtualPaymentClientURL"]);
unset($_POST["SubButL"]);
$md5HashData = $SECURE_SECRET;
ksort ($_POST);
$appendAmp = 0;
foreach($_POST as $key => $value) {
if (strlen($value) > 0) {
if ($appendAmp == 0) {
$vpcURL .= urlencode($key) . '=' . urlencode($value);
$appendAmp = 1;
} else {
$vpcURL .= '&' . urlencode($key) . "=" . urlencode($value);
}
$md5HashData .= $value;
}
}
if (strlen($SECURE_SECRET) > 0) {
$vpcURL .= "&vpc_SecureHash=" . strtoupper(md5($md5HashData));
}
header("Location: ".$vpcURL);
It is redirecting to the payment gateway as it should be. The problem is that the response i get after payment is not encoded. the response link is like this (for security reasons i have changed the numerals with x)
https://xxxxxx/site_test/vpc_php_serverhost_dr.php?vpc_Amount=xx&vpc_BatchNo=x&vpc_Command=pay&vpc_Locale=en&vpc_MerchTxnRef=xxxxx&vpc_Merchant=xxxxx&vpc_Message=Cancelled&vpc_OrderInfo=xxxxx&vpc_SecureHash=xxxxxxxx&vpc_TransactionNo=x&vpc_TxnResponseCode=C&vpc_Version=xx
What should I do to make the response url encoded?
Have you tried using:
<?php
$query_string = 'foo=' . urlencode($foo) . '&bar=' . urlencode($bar);
echo '<a href="mycgi?' . htmlentities($query_string) . '">';
?>
http://php.net/manual/en/function.urlencode.php

populating form with mysql data

Hopefully someone can help with my problem, I have a database using MySQL and I have a form that posts to the database, this all works fine.
I have created a customer look up form using HTML and PHP that echos a table and then the table is filled with the MySQL data, again this all works OK.
My problem is that I would like to click the table row or text in that row which ever and open it in a HTML form and include all the data from the row in the MySQL database.
<div id="content">
<h3>Customer Lookup</h3>
<?php
$con=mysqli_connect("localhost","root","","repairsdb");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM customers");
echo "<table border='1'>
<tr>
<th>First Name</th>
<th>Surname</th>
<th>Address</th>
<th>Postcode</th>
<th>Landline</th>
<th>Mobile</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['firstname'] . "</td>";
echo "<td>" . $row['surname'] . "</td>";
echo "<td>" . $row['addressl1'] . "</td>";
echo "<td>" . $row['postcode'] . "</td>";
echo "<td>" . $row['landline'] . "</td>";
echo "<td>" . $row['mobile'] . "</td>";
echo "<td>" . $row['businessname'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
<FORM>
</FORM>
</div>
New Code
<h3>Customer Lookup</h3>
<?php
$con=mysqli_connect("localhost","root","","repairsdb");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM customers");
echo "<table border='1'>
<tr>
<th>First Name</th>
<th>Surname</th>
<th>Address</th>
<th>Postcode</th>
<th>Landline</th>
<th>Mobile</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td><a href='/repairdb/customer_form.php?customerid=" . $row['customerid'] . "'>" . $row['firstname'] . "</td>";
echo "<td>" . $row['surname'] . "</td>";
echo "<td>" . $row['addressl1'] . "</td>";
echo "<td>" . $row['postcode'] . "</td>";
echo "<td>" . $row['landline'] . "</td>";
echo "<td>" . $row['mobile'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
customer_form.php
<?php
$con=mysqli_connect("localhost","root","","repairsdb");
if( isset( $_GET['customerid'] ) ) {
$customerid = $_GET['customerid'];
}
$result = mysqli_query($con,"SELECT * FROM customers where customerid = " . $customerid . " Limit 1");
?>
<form method="post">
<input type="text" name="firstname" value="$result['firstname']" />
<input type="text" name="surname" value="$result['surname']" />
<input type="text" name="addressl1" value="$result['addressl1']" />
<input type="text" name="postcode" value="$result['postcode']" />
<input type="text" name="landline" value="$result['landline']" />
<input type="text" name="mobile" value="$result['mobile']" />
<input type="text" name="businessname" value="$result['businessname']" />
</form>
The easiest way to do this would be to open the form in a new page. So to do this we would start by adding a link to your table.
I'm going to assume that in your database you have an unique ID for each customer - we will use this in the link:
echo "<tr>";
echo "<td><a href='/customer_form.php?customer_id=" . $row['ID'] . "'>" . $row['firstname'] . "</a></td>";
echo "<td>" . $row['surname'] . "</td>";
echo "<td>" . $row['addressl1'] . "</td>";
echo "<td>" . $row['postcode'] . "</td>";
echo "<td>" . $row['landline'] . "</td>";
echo "<td>" . $row['mobile'] . "</td>";
echo "<td>" . $row['businessname'] . "</td>";
echo "</tr>";
As you can see I have named the new page customer_form.php. And we will pass the ID to this page via the URL, like so.
www.example.com/customer_form.php?customer_id=3
In your new customer_form.php page you will first need to retrieve the ID from the URL.
if( isset( $_GET['customer_id'] ) ) {
$customer_id = $_GET['customer_id'];
}
Then we will modify this block of code a little more to retrieve the customer from the database, using the ID, and then we can add this data to a new form.
if( isset( $_GET['customer_id'] ) ) {
$customer_id = $_GET['customer_id'];
$result = mysqli_query($con,"SELECT * FROM customers where ID = " . $customer_id . " Limit 1");
echo '
<form method="post">
<input type="text" name="firstname" value="'. $result['firstname'] .'" />
<input type="text" name="surname" value="'. $result['surname'] .'" />
<input type="text" name="addressl1" value="'. $result['addressl1'] .'" />
<input type="text" name="postcode" value="'. $result['postcode'] .'" />
<input type="text" name="landline" value="'. $result['landline'] .'" />
<input type="text" name="mobile" value="'. $result['mobile'] .'" />
<input type="text" name="businessname" value="'. $result['businessname'] .'" />
</form>
';
}
You could do it other ways, in a pop up window, or even on the same page using JavaScript. But this is the least complicated.
I should note that the SQL query I wrote would be vulnerable to SQL injection, since it takes a value from the address bar and injects it directly into the query. But it's a little outside of the scope of the question, so I suggest you look it up if interested.
sounds like this would work...
use clicks on link (selects something in)
then - jqueryAJAX POSTs FORM
then - php processPOST
then - mysql getDataFrom DB
then - php process MYSQL results && echo $jsoResults
then - jqueryAJAX process results open new Form with inputs populated...
I managed to sort the errors, I have posted the code for anyone having the same problem. I have answered this question myself only for the reason so I can post the final code, but the credit has to go to #user1100149 and also a chap on YouTube.
Link to youtube video editing mysql with PHP
<?php
// Connects to Our Database
mysql_connect("localhost", "root", "") or die(mysql_error());
mysql_select_db("repairsdb") or die(mysql_error());
if(!isset ($_POST['submit'])) {
$q = "SELECT * FROM customers WHERE customerid = $_GET[customerid]";
$result = mysql_query($q);
$person = mysql_fetch_array($result)or die (mysql_error());
}
?>
<form name="submit_customer" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<div id="frcol3">
<fieldset>
<label id="label" for="webaddress">Business</label>
<input name="businessname" type="text" class="inputBox" id="" value="<?php echo $person['businessname']; ?>" />
<label id="label" for="firstname">First Name</label>
<input class="inputBox" type="text" name="firstname" id="" value="<?php echo $person['firstname']; ?>" />
<label id="label" for="Surname">Surname</label>
<input name="surname" type="text" class="inputBox" id="" value="<?php echo $person['surname']; ?>" />
<label id="label" for="landline">Telephone No.</label>
<input name="landline" type="text" class="inputBox" id="" value="<?php echo $person['landline']; ?>" />
<label id="label" for="mobile">Mobile No.</label>
<input name="mobile" type="text" class="inputBox" id="" value="<?php echo $person['mobile']; ?>" />
<label id="label" for="email">Email</label>
<input name="email" type="text" class="inputBox" id="" value="<?php echo $person['email']; ?>" />
</fieldset>
</div>
<div id="frcol2">
<fieldset>
<label id="label" for="webaddress">Web Address</label>
<input name="webaddress" type="text" class="inputBox" id="" value="<?php echo $person['webaddress']; ?>" />
<label id="label" for="addressl1">Address Line 1</label>
<input name="addressl1" type="text" class="inputBox" id="" value="<?php echo $person['addressl1']; ?>" />
<label id="label" for="addressl2">Address Line 2</label>
<input name="addressl2" type="text" class="inputBox" id="" value="<?php echo $person['addressl2']; ?>" />
<label id="label" for="town">Town</label>
<input name="town" type="text" class="inputBox" id="" value="<?php echo $person['town']; ?>" />
<label id="label" for="county">County</label>
<input name="county" type="text" id="" class="inputBox" value="<?php echo $person['county']; ?>" />
<label id="label" for="postcode">Postcode</label>
<input name="postcode" type="text" id="" class="inputBox" value="<?php echo $person['postcode']; ?>" />
</fieldset>
</div>
<div id="frcol1">
<textarea name="notes" id="notes" placeholder="<?php echo $person['notes']; ?>" cols="45" rows="5"></textarea>
<br />
<input type="hidden" name="customerid" value="<?php echo $_GET['customerid']; ?>" />
<input type="submit" name="submit" id="" class=" button" value="Submit" />
</div>
</form>

i need to have a form get values from outside forms or a workaround

i know little javascript and im guessing there is some way to do this but my problem persists in php and i would like to solve it in php
I have one main form which contains one deleteAll button and i have check boxes in the other multiple forms
how can i press my deleteAll button and get the names of the checkboxes checked (because they go with its id) and eventually grab their name and perform mysql to delete
here is my code that loops and produces one form for one delete all button
and loops through my database only to generate many forms like so
echo '<div class="span12"><form action="admin/tool/editvehicle.php" method="post">
<button id="deleteall" name="deleteall" class="btn btn-danger" type="submit" >Delete</button></form>
</div>';
//get the total number of vehicles active in the database to loop through them and displaying them to manage
$query = mysql_query("SELECT COUNT('auto_id') FROM `auto`");
$all = mysql_result($query, 0); //store the value so we can run this loop accordingly
$i = 1;
$auto_id = 0; //auto id equal to zero as starting point, it will increase randomly to as many vehicles it will diplay
while ($i <= $all) //ie run for every car
{
$fields = 'auto_id, year, make, model, engine, sound_system,mileage, price, att1, att2, att3, att4, att5, att6, att7, att8,
att9, att10, att11, att12, att13, att14, att15, picture1, picture2, picture3, picture4, picture5, picture6, picture7, picture8,
picture9, picture10, picture11, picture12';
//check where the auto id is greater then the previously one according to $auto_id which increments
$data = mysql_fetch_assoc(mysql_query("SELECT $fields FROM `auto` WHERE `auto_id` > $auto_id"));
$auto_id = $data['auto_id']; //here is the magic, we set the auto id to the current one being spitted out so it follows through
//now with all the $data retrieved from the database we can print car by car with its unique info and ids
echo '<div id="displaycarwrap" class="span3 container">
<input id="deletebox" type="checkbox" name="a">
<a href"#"><img src="' . $data['picture1'] . '"></img></a>
<form action="admin/tool/editvehicle.php" method="post">
<ul>
<li>
<br><b>Price</b>: <input name="price" type="text" class="span2" value="' . $data['price'] . '">
</li>
<li>
<button name="delete" class="btn btn-danger" type="submit" >Delete Vehicle</button>
</li>
<li>
<button class="btn btn-primary" name="editpictures" type="submit" >Edit Pictures</button>
</li>
<li>
<button type="submit" name="editauto" class="btn btn-inverse" >Apply Changes</button>
</li>
</ul>
<button class="btn btn-mini show_hide icon-th-list" href="#" rel="#slidingDiv'. $i .'">View details</button>
<div id="slidingDiv'. $i .'" class="toggleDiv" style="display: none;">
<ul> <br />
<li><b>Year</b>:<br /><input type="text" name="year" value="' . $data['year'] . '" class="span2"></li>
<li><b>Make</b>: <br /><input type="text" name="make" value="' . $data['make'] . '" class="span2"></li>
<li><b>Model</b>: <br /><input type="text" name="model" value="' . $data['model'] . '" class="span2"></li>
<li><b>Mileage</b>: <br /><input type="text" name="mileage" value="' . $data['mileage'] . '" class="span2"></li>
<li><b>Engine</b>:<br /> <input type="text" name="engine" value="' . $data['engine'] . '" class="span2"></li>
<li><b>Stereo</b> <br /><input type="text" name="sound_system" value="' . $data['sound_system'] . '" class="span2"></li>
<li><b>Attribute 1 </b> <input type="text" name="att1" value="' . $data['att1'] . '" class="span2"></li>
<li><b>Attribute 2</b> <input type="text" name="att2" value="' . $data['att2'] . '" class="span2"></li>
<li><b>Attribute 3</b> <input type="text" name="att3" value="' . $data['att3'] . '" class="span2"></li>
<li><b>Attribute 4</b> <input type="text" name="att4" value="' . $data['att4'] . '" class="span2"></li>
<li><b>Attribute 5</b> <input type="text" name="att5" "value="' . $data['att5'] . '" class="span2"></li>
<li><b>Attribute 6</b> <input type="text" name="att6" value="' . $data['att6'] . '" class="span2"></li>
<li><b>Attribute 7</b> <input type="text" name="att7" value="' . $data['att7'] . '" class="span2"></li>
<li><b>Attribute 8</b> <input type="text" name="att8" value="' . $data['att8'] . '" class="span2"></li>
<li><b>Attribute 9</b> <input type="text" name="att9" value="' . $data['att9'] . '" class="span2"></li>
<li><b>Attribute 10</b> <input type="text" name="att10" value="' . $data['att10'] . '" class="span2"></li>
<li><b>Attribute 11</b> <input type="text" name="att11" value="' . $data['att11'] . '" class="span2"></li>
<li><b>Attribute 12</b> <input type="text" name="att12" value="' . $data['att12'] . '" class="span2"></li>
<li><b>Attribute 13</b> <input type="text" name="att13" value="' . $data['att13'] . '" class="span2"></li>
<li><b>Attribute 14</b> <input type="text" name="att14" value="' . $data['att14'] . '" class="span2"></li>
<li><b>Attribute 15</b> <input type="text" name="att15" value="' . $data['att15'] . '" class="span2"></li>
<li><input type="text" name="auto_id" value="' . $data['auto_id'] . '" class="span2" readonly><li>
<ul>
</div>
</form>
</div>';
$i++; //used for the while loop
}
You can add form id to form inside while loop and can call jquery to get checked checkboxes values like
$("input[name='foo[]']:checked:enabled",'#myform');
where myform is your form id
OR
for all checked check boxes try jquery :
$("input[type='checkbox']:checked")

Categories