updating filtered mysql rows in php - php

I'm trying to update different rows from mysql that they filtered by some record . in this code first the user should enter two input : classnumber and level .
records that they have this fields will show in table then the user should be able to update this records information . but the problem is all of records are in one table in mysql so their id is different I mean for example the first record that match with two inputs id is 2 and then the next one is 5 and next one 6 and ....
with this kind of situation how should I change the code below ?
<form id="searchform" method="post" dir="rtl" action="">
level :<input name="level" style="margin-top:5px; margin-left:6px;font-family: Tahoma,Geneva,sans-serif; font-size: 12px; margin-top: 5px; padding: 5px; width: 50px;" type="text" id="level" />
classnumber :<input name="classnum" style="margin-top:5px; margin-left:6px;font-family: Tahoma,Geneva,sans-serif; font-size: 12px; margin-top: 5px; padding: 5px; width: 50px;" type="text" id="classnum" />
<input style="margin-top:10px; margin-left:120px; font-size: 14px; padding: 5px 14px;" type="submit" value="جستجو" name="enter" />
</form>
<?php
if(isset($_POST['enter'])){
$sql="SELECT * FROM `".$tbl_name."` where classnum='".$_REQUEST['classnum']."' and level='".$_REQUEST['level']."' ";
$result=mysql_query($sql,$link);
$count=mysql_num_rows($result);
}
?>
<div class="cleaner h30"></div>
<br>
<form name="form1" action="" method="POST">
<center>
<div>
<div align="center" width = 615>
<table class="stats" cellspacing="0" width="615" border="1">
<tr>
<th width="20" scope="col" >Id</th>
<th width="60" scope="col">Name</th>
<th width="60" scope="col">Last Name</th>
<th width="42" scope="col">Midterm</th>
<th width="54" scope="col">Class mark</th>
<th width="42" scope="col">Final Quiz</th>
<th width="54" scope="col">State</th>
<th width="54" scope="col">Details</th>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
$id[]=$rows['id'];
?>
<tr>
<td align="center">
<input name="id[]" type="text" id="id" value="<? echo $rows['id']; ?>" style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 10px;"></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 60px;" type="text" name="name[]" id="name" value= "<? echo $rows['name']; ?>" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 60px;" type="text" name="lastname[]" id="lastname" value= "<? echo $rows['lastname']; ?>" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="midmark[]" id="midmark" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="classmark[]" id="classmark" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="finalmark[]" id="finalmark" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="state[]" id="state" /></td>
<td align="center"><input style=" font-family: Tahoma,Geneva,sans-serif; font-size: 12px; padding: 5px; width: 50px;" type="text" name="details[]" id="details" /></td>
</tr>
<?php
}
?>
</table>
</div>
</div>
</center>
<input style="margin-top:10px; float:right; margin-right:175px; font-size: 14px; padding: 5px 14px;" type="submit" value="ثبت" name="Submit" />
</form>
<?php
// Check if button name "Submit" is active, do this
if(isset($_POST['Submit']))
{
for($i=0;$i<$count;$i++)
{
$sql1=mysql_query(" UPDATE `".$tbl_name."` SET midmark='".$_REQUEST['midmark'][$i]."' , classmark='".$_REQUEST['classmark'][$i]."' , finalmark='".$_REQUEST['finalmark'][$i]."' , state='".$_REQUEST['state'][$i]."' , details='".$_REQUEST['details'][$i]."' WHERE id='".$_REQUEST['id'][$i]."' "); $result1=mysql_query($sql1);
}
}
if($result1){
header("location:results.php");
}
mysql_close();
?>

Related

Object not found XAMPP PHP error

I am trying to run a php file using xampp but I'm getting the Object not found error, I watched some videos where people say create another folder and run it under that but that is not working for me! look at the screenshot below and please if you could help me understand why this isn't working
enter image description here
Please note even if i use another file such as footer.php i get the same error.
here is the code for mens.php i didnt include it in the screenshot
<?php
session_start();
//unset($_SESSION['basket']);
?>
<!DOCTYPE html>
<html>
<head>
<!-- External Stylesheet -->
<link rel="stylesheet" href="style.css" type="text/css" />
<title>Mens</title>
</head>
<body>
<div class="bar">Sale Now On!</div>
<div id="outer">
<?php
include('header.php');
?>
<!-- All content will be wrapped insisde this container -->
<div id="container">
<!-- Page -->
<h2>Mens Clothing</h2>
<table width="100%" cellpadding="0" cellspacing="0">
<tr class="headings">
<th style="width: 20%;">Photo</th>
<th style="width: 30%;">Desciption</th>
<th style="width: 10%;">Size</th>
<th style="width: 10%;">Price</th>
<th style="width: 10%;">Qty</th>
<th style="width: 20%;">Action</th>
</tr>
<form action="addtocart.php" method="post" name="addtocart">
<tr class="datarow">
<td style="width: 20%; text-align: center; border-left:dotted
1px #333; border-bottom: dotted 1px #333; border-right:dotted 1px #333;">
<img src="img/suit.jpg" width="112px" />
</td>
<td style="width: 30%; text-align: center; border-bottom:
dotted 1px #333; border-right:dotted 1px #333;">Contempary Hugo Boss
Suit</td>
<input type="hidden" name="itemdesc" value="Contempary Hugo Boss
Suit" />
<input type="hidden" name="sku" value="100" />
<input type="hidden" name="pic" value="suit.jpg" />
<td style="width: 10%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<select name="size">
<option value="S">Small</option>
<option value="M">Medium</option>
<option value="L">Large</option>
</select>
</td>
<td style="width: 10%; text-align: center; border-bottom:
dotted 1px #333; border-right:dotted 1px #333;">£500.00</td>
<input type="hidden" name="price" value="500.00" />
<td style="width: 10%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<select name="qty">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>
<td style="width: 20%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<input type="submit" name="submit" value="Add to Basket" />
</td>
</tr>
</form>
<form action="addtocart.php" method="post" name="addtocart">
<tr class="datarow">
<td style="width: 20%; text-align: center; border-left:dotted
1px #333; border-bottom: dotted 1px #333; border-right:dotted 1px #333;">
<img src="img/suit1.jpg" width="112px" />
</td>
<td style="width: 30%; text-align: center; border-bottom:
dotted 1px #333; border-right:dotted 1px #333;">Wool Hugo Boss Suit</td>
<input type="hidden" name="itemdesc" value="Wool Hugo Boss Suit"
/>
<input type="hidden" name="sku" value="101" />
<input type="hidden" name="pic" value="suit1.jpg" />
<td style="width: 10%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<select name="size">
<option value="S">Small</option>
<option value="M">Medium</option>
<option value="L">Large</option>
</select>
</td>
<td style="width: 10%; text-align: center; border-bottom:
dotted 1px #333; border-right:dotted 1px #333;">£450.00</td>
<input type="hidden" name="price" value="450.00" />
<td style="width: 10%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<select name="qty">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</td>
<td style="width: 20%; text-align: center; border-bottom: dotted
1px #333; border-right:dotted 1px #333;">
<input type="submit" name="submit" value="Add to Basket" />
</td>
</tr>
</form>
</table>
</div>
</div>
<?php
include('footer.php');
?>
</body>
</html>
A file called ._mens.php Is NOT the same as a file called mens.php
As you are using the url localhost/example/mens.php then the file needs to be called mens.php

Valid Regex Not so valid in PHP [duplicate]

This question already has answers here:
Warning: preg_replace(): Unknown modifier
(3 answers)
Closed 5 years ago.
So i want to extract everything in between form tags (including the tags them selves).
The form is as below:
<body><br />
<!--
<form method="POST" action="#">
<table style="table-layout: fixed; border: 1px solid #ffffff; " border="1">
<!--
<col width="50"> --></p>
<tr style="width: 1154px; background-color: #0d56c2; vertical-align: middle; color: #ffffff; height: 70px; ">
<td style="width: 413px; text-align: center;">Calls</td>
<td style="background-color: #D6DCE5; width: 319px; padding-left: 20px; padding-top: 15px;"><input type="text" name="calls" value="150" style="width: 173px;"></td>
<td style="width: 412px; padding: 5px; vertical-align: middle;"> in a period of <input name="period" value="5" style="width: 173px; "> <br />
<select name="callUnit" style="width: 100px; height: 29px; position: absolute;"><option value="hour" selected>hours</option><option value="minute" >minutes</option></select>
</td>
</tr>
</table>
</form>
</body>
Regex i am using is: <form.*>[\s\S]*<\/form> and according to regex101 This is a valid regular expression that should extract form tags + everthing in between.
However using the above regular expression in preg_match i get the following error: Warning: preg_match(): Unknown modifier '['
Not sure what you actual issue is. For me your pattern works like charm:
<?php
$markup = <<<HTML
<body><br />
<!--
<form method="POST" action="#">
<table style="table-layout: fixed; border: 1px solid #ffffff; " border="1">
<!--
<col width="50"> --></p>
<tr style="width: 1154px; background-color: #0d56c2; vertical-align: middle; color: #ffffff; height: 70px; ">
<td style="width: 413px; text-align: center;">Calls</td>
<td style="background-color: #D6DCE5; width: 319px; padding-left: 20px; padding-top: 15px;"><input type="text" name="calls" value="150" style="width: 173px;"></td>
<td style="width: 412px; padding: 5px; vertical-align: middle;"> in a period of <input name="period" value="5" style="width: 173px; "> <br />
<select name="callUnit" style="width: 100px; height: 29px; position: absolute;"><option value="hour" selected>hours</option><option value="minute" >minutes</option></select>
</td>
</tr>
</table>
</form>
</body>
HTML;
preg_match('~<form.*>([\s\S]*)</form>~', $markup, $tokens);
var_dump($tokens[1]);
The output of that is:
string(829) "
<table style="table-layout: fixed; border: 1px solid #ffffff; " border="1">
<!--
<col width="50"> --></p>
<tr style="width: 1154px; background-color: #0d56c2; vertical-align: middle; color: #ffffff; height: 70px; ">
<td style="width: 413px; text-align: center;">Calls</td>
<td style="background-color: #D6DCE5; width: 319px; padding-left: 20px; padding-top: 15px;"><input type="text" name="calls" value="150" style="width: 173px;"></td>
<td style="width: 412px; padding: 5px; vertical-align: middle;"> in a period of <input name="period" value="5" style="width: 173px; "> <br />
<select name="callUnit" style="width: 100px; height: 29px; position: absolute;"><option value="hour" selected>hours</option><option value="minute" >minutes</option></select>
</td>
</tr>
</table>
"
The only modification I made is to add the capture group ((...)) to be able to actually extract something.
You are escaping the forward slash in the closing </form> tag with a back slash. Most likely that is because online regex tools like regex101 use forward slashes as standard delimiters in their patterns. Note that you can use other characters which makes the pattern easier to read, since you do not have to escape characters then...
I suspect that you maybe forgot to place your pattern in between delimiters?

How to send bulk email by click button at one time using codeigniter

How to send bulk email by clicking button at one time using codeigniter...I got an error while doing bulk email in codeigniter.I need to rectify this one..i need help for this problem
This is my controller
<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Send_all extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->database();
$this->load->library(array('session', 'form_validation'));
$this->load->model('user_model');
$this->load->model('Gst_model');
$this->load->model('Report_model');
}
public function index($email_cript, $vendor_id)
{
$VendorEmail = base64_decode($email_cript);
$this->db->where('VendorEmail', $VendorEmail);
$query=$this->db->get('gst_vendormaster');
$cust_details= $query->result();
$data['cust_details'] = $cust_details;
//$mail_to = "$VendorEmail";
//$mail_count= count($mail_to);
$to_mail = explode(',', $VendorEmail);
$mail_count= count($to_mail);
for($VendorEmail=0;$VendorEmail < $mail_count;$VendorEmail++)
{
$data['VendorEmail'] = $cust_details[0]->VendorEmail;
print_r($VendorEmail);
$config = array(
'protocol' => 'sendmail',
'mailtype' => 'html',
'charset' => 'UTF-8',
);
$this->load->library('email');
$this->email->initialize($config);
$this->email->set_newline("\r\n");
$this->email->set_mailtype("html");
$mail_id = TRIM($to_mail[$VendorEmail]);
$message =
'<p> </p>
<table class="body" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%; background-color: #f6f6f6;" border="0" width="100%" cellspacing="0" cellpadding="0" bgcolor="#f6f6f6">
<tbody>
<tr>
<td style="font-family: sans-serif; font-size: 14px; vertical-align: top;" valign="top"><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 13.3333px;"> </span></span></td>
<td class="container" style="font-family: sans-serif; font-size: 14px; vertical-align: top; display: block; margin: 0 auto !important; max-width: 580px; padding: 10px; width: 580px;" valign="top" width="580">
<div class="content" style="box-sizing: border-box; display: block; margin: 0 auto; max-width: 580px; padding: 10px;">
<table class="main" style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; box-shadow: 0px 2px 18px 0px rgba(0,0,0,2); width: 100%; background: #fff; border-radius: 3px;" border="0" width="100%">
<tbody>
<tr>
<td class="wrapper" style="font-family: sans-serif; font-size: 14px; vertical-align: top; box-sizing: border-box; padding: 20px;" valign="top">
<table style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" border="0" width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="font-family: sans-serif; font-size: 14px; vertical-align: top;" valign="top">
<p><img src="http://www.miisky.com/ci/GST.png" alt="" width="85" height="84" /> <strong>GST - IMPLEMENTATION <img src="http://www.aarmsvaluechain.com/images/value-chain.png" alt="" width="98" height="84" /> </strong></p>
<p>Dear Sir / Madam,</p>
<p>As you are aware, the Government of India introduced Good and Service Tax (“GST”) in August, 2016 which will subsume the existing indirect taxes in India such as value added tax (“VAT”), service tax, central excise, entertainment tax, entry tax etc.. </p>
<p>As part of the GST regime, various state governments have initiated the GST enrolment process of existing VAT taxpayer registered with various State VAT departments. Accordingly, we would request you to confirm if you have completed the enrolment process and obtained the provisional ID from relevant State VAT department. In the event, the enrolment process is yet to commence in State in which you are registered as a VAT taxpayer, we would request you to confirm the receipt of the provisional ID at the earliest possible.</p>
<p>The process of enrolment and obtaining provisional IDs from State VAT department is provided on http://tutorial.gst.gov.in/video/module/index.html. </p>
<p>We have already have got the Provisional Registration Certificate and details of the same is provided below.</p>
<!--Left off format-->
<table cellpadding="5px" align="center" border="4">
<tbody>
<tr><th>Name of the Assesse</th><th>Provisional ID</th></tr>
<tr>
<td>Emerson Process Management Chennai Private Limited</td>
<td>33AAACF0483F1Z3</td>
</tr>
</tbody>
</table>
<p>We would also request you to identify and ascertain the HSN (Harmonized System of Nomenclature) number of the products supplied to us under the Agreement. Under the model GST laws, HSN code of the product must be mentioned in the invoice issued by you..</p>
<p>Separately, with the introduction of GST and model GST laws, the existing agreement needs be amended to incorporate for fresh/ revised covenants and obligations considering GST laws, and regarding revised commercials, as the parties may mutually decide. Accordingly, discussions in this regard would be initiated in due course.</p>
<p>We request you to provide your Provisional id details as per the below format:</p>
<table style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: auto;" border="0" cellspacing="5" cellpadding="5">
<tbody>
<tr>
<td style="font-family: sans-serif; font-size: 14px; vertical-align: top; background-color: #00ff99; border-radius: 0px; text-align: center;" align="center" valign="top" bgcolor="#00ff99"><a style="display: inline-block; color: #ffffff; width: 500px; background-color: #00ff99; border: solid 1px #00ff99; border-radius: 5px; box-shadow: 0px 2px 18px 0px rgba(0,0,0,0.5); box-sizing: border-box; cursor: pointer; text-decoration: none; font-size: 14px; font-weight: bold; margin: 0; padding: 12px 25px; text-transform: capitalize; border-color: #00ff99;" title="GSTN Number Updation" href="http://www.miisky.com/ci/index.php/Customerlink/vendorRecive/'.$vendor_id.'"><span style="color: #000000; font-family: Arial, Helvetica, sans-serif;">Click to view the GSTN Updation form</span></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<p>We hereby authorize M/S. Arms Value Chain Private Limited to collect and consolidate GST Registration details and request you to please share the details to them.</p>
<p>We look forward to your full support in smooth transition to the GST regime.</p>
<br />
<p>Best Regards,</p>
<p>S Hariharan <br /> Emerson Process Management Chennai Pvt. Ltd | 147, Rajiv Gandhi Salai (OMR) | Karapakkam Village | Chennai | 600097 | INDIA <br /> T +91 44 4903 4373 | F +91 44 4903 4400 <br /> hariharan.s#Emerson.com
<p>CIN:U93090TN 1985 PTC 024245</p>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
<div class="footer" style="clear: both; padding-top: 10px; text-align: center; width: 100%;">
<table style="border-collapse: separate; mso-table-lspace: 0pt; mso-table-rspace: 0pt; width: 100%;" border="0" width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="content-block" style="font-family: sans-serif; vertical-align: top; padding-top: 10px; padding-bottom: 10px; font-size: 12px; color: #999999; text-align: center;" align="center" valign="top"><span style="color: #000000; font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 13.3333px;"><span class="apple-link" style="color: #000000; font-size: 12px; text-align: center;"><strong>Powered by:AARMS value chain pvt ltd</strong></span> <br /><br /></span></span></td>
</tr>
<tr>
<td class="content-block powered-by" style="font-family: sans-serif; vertical-align: top; padding-top: 10px; padding-bottom: 10px; font-size: 12px; color: #999999; text-align: center;" align="center" valign="top"><span style="color: #000000; font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 13.3333px;"> </span></span></td>
</tr>
</tbody>
</table>
</div>
<p><span style="font-family: Arial, Helvetica, sans-serif;"><span style="font-size: 13.3333px;"> </span></span></p>
<div> </div>';
$from_mail = 'your#vendor.com';
$from_name = 'GST-MIISKY';
$reply_to = 'innovations#miisky.com';
$subject = "Online GSTIN Updation!";
//$file_name = $datamail['varafile'];
//$path = realpath('uploads/abstract');
// Read the file content
//$file = $path . '/' . $file_name;
$this->load->library('email', $config);
$this->email->from($from_mail, $from_name);
$this->email->to($mail_id);
$this->email->cc('innovations#miisky.com');
$this->email->subject($subject);
$this->email->message($message);
//$this->email->attach($file);
}
if ($this->email->send()) {
$this->session->set_flashdata('msg','<div class="alert alert-success text-center">Mail Succesfully Sent!</div>');
redirect('Vendor_retrieve');
}
}
}
This is my view page
<?php $firm_name = $this->session->userdata('firm_name');
if(!isset($firm_name)){ redirect ('Welcome');}
?>
<link href="<?php echo base_url("assets/css/radiostyle.css"); ?>" rel="stylesheet">
<head>
<style type="text/css">
#import url("http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css");
/*
FORM STYLING
*/
#fileselector {
margin: 10px;
}
#upload-file-selector {
display:none;
}
.margin-correction {
margin-right: 10px;
}
.page-heading {
border-top: 0;
padding: 0px 10px 10px 10px;
}
input, button, select, textarea{
margin: 10px;
}
.ibox-content {
background-color: #ffffff;
color: inherit;
padding: 15px 20px 20px 20px;
border-color: #e7eaec;
border-image: none;
border-style: none;
border-width: 1px 0px;
}
.filterable {
margin-top: 10px;
}
.filterable .panel-heading .pull-right {
margin-top: -20px;
}
.filterable .filters input[disabled] {
background-color: transparent;
border: none;
cursor: auto;
box-shadow: none;
padding: 0;
height: auto;
}
.filterable .filters input[disabled]::-webkit-input-placeholder {
color: #333;
}
.filterable .filters input[disabled]::-moz-placeholder {
color: #333;
}
.filterable .filters input[disabled]:-ms-input-placeholder {
color: #333;
}
.form-control, .single-line {
width: 90%;
}
.btn-group-xs>.btn, .btn-xs {
padding: 0px 15px;
line-height: 1;
}
.btn {
border-radius: 3px;
}
.btn-info {
background-color: #ffffff;
border-color: #ffffff;
color: #191717;
font-weight: bolder;
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);
}
</style>
</head>
<div class="row wrapper border-bottom white-bg page-heading">
<div class="col-lg-12 text-center">
<h1>GST - Vendor</h1>
</div>
</div>
<br><div style="text-align: center;">
<label class="control control--radio">Vendor
<input type="radio" onclick="document.location='<?php echo base_url(); ?>index.php/Vendor_retrieve';" name="radio1" checked="checked" />
<div class="control__indicator"></div>
</label>
<label class="control control--radio">Customer
<input type="radio" onclick="document.location='<?php echo base_url(); ?>index.php/Customer_retrieve';" name="radio2" />
<div class="control__indicator"></div>
</label>
<label class="control control--radio">Product
<input type="radio" onclick="document.location='<?php echo base_url(); ?>index.php/Product_retrieve';" name="radio3" />
<div class="control__indicator"></div>
</label>
<label class="control control--radio">Item
<input type="radio" onclick="document.location='<?php echo base_url(); ?>index.php/Item_retrieve';" name="radio4" />
<div class="control__indicator"></div>
</label>
<label class="control control--radio">Rate
<input type="radio" onclick="document.location='<?php echo base_url(); ?>index.php/Category_retrieve';" name="radio5" />
<div class="control__indicator"></div>
</label>
<label class="control control--radio">Location
<input type="radio" onclick="document.location='<?php echo base_url(); ?>index.php/Vendorlocation';" name="radio6" />
<div class="control__indicator"></div>
</label>
</div>
<div class="fh-breadcrumb">
<div class="full-height">
<div class="full-height-scroll white-bg border-left">
<?php echo $this->session->flashdata('msg'); ?>
<?php echo $this->session->flashdata('message'); ?>
<div class="element-detail-box">
<div class="table-responsive">
<table class='table table-bordered'>
<thead>
<tr>
<th> # </th>
<th> VendorID </th>
<th> VendorCode </th>
<th> VendorName </th>
<th> VendorEmail </th>
<th> VendorMobile </th>
<th> VendorAddress </th>
<th> Department </th>
<th> Division </th>
<th> State </th>
<th> City </th>
<th> CST_NO </th>
<th> TIN_NO </th>
<th> VAT_NO </th>
<th> SGST_NO </th>
<th> CGST_NO </th>
<th> IGST_NO </th>
<th> MSME_RegNO </th>
<th> MSME_Category </th>
<th> Send Mail</th>
<th> Edit </th>
<th> Delete </th>
</thead>
<tbody>
<?php for ($i = 0; $i < count($catlist); ++$i) { ?>
<tr>
<td><?php echo ($i+1); ?></td>
<td><?php echo $catlist[$i]->VendorID; ?></td>
<td><?php echo $catlist[$i]->VendorCode; ?></td>
<td><?php echo $catlist[$i]->VendorName; ?></td>
<td><?php echo $catlist[$i]->VendorEmail; ?></td>
<td><?php echo $catlist[$i]->VendorMobile; ?></td>
<td><?php echo $catlist[$i]->VendorAddress; ?></td>
<td><?php echo $catlist[$i]->Department; ?></td>
<td><?php echo $catlist[$i]->Division; ?></td>
<td><?php echo $catlist[$i]->State; ?></td>
<td><?php echo $catlist[$i]->City; ?></td>
<td><?php echo $catlist[$i]->CST_NO; ?></td>
<td><?php echo $catlist[$i]->TIN_NO; ?></td>
<td><?php echo $catlist[$i]->VAT_NO; ?></td>
<td><?php echo $catlist[$i]->SGST_NO; ?></td>
<td><?php echo $catlist[$i]->CGST_NO; ?></td>
<td><?php echo $catlist[$i]->IGST_NO; ?></td>
<td><?php echo $catlist[$i]->MSME_RegNO; ?></td>
<td><?php echo $catlist[$i]->MSME_Category; ?></td>
<?php $encoded_mail = base64_encode($catlist[$i]->VendorEmail);?>
<?php $encoded_id = base64_encode($catlist[$i]->VendorID);?>
<td><?php echo anchor('Vendormail/index/'.$encoded_mail .'/'.$encoded_id , 'Send Mail', 'class="btn btn-info"');?></td>
<td><a style=" background-color: rgba(106, 200, 35, 0.61);" href="<?php echo base_url(); ?>index.php/Vendor_retrieve/edit_data/<?php echo $catlist[$i]->VendorID?>" class="btn btn-info" role="button">Edit</a></td>
<!-- <td><?php echo anchor('Vendor_retrieve/edit_data/'.$catlist[$i]->VendorID, ' Edit');?></td> -->
<td><a style=" background-color: #f85959;" href="<?php echo base_url(); ?>index.php/Vendor_retrieve/delete_data/<?php echo $catlist[$i]->VendorID?>" class="btn btn-info" role="button">Delete</a></td>
<!-- <td><?php echo anchor('Vendor_retrieve/delete_data/'.$catlist[$i]->VendorID, ' Delete');?></td> -->
</tr>
<?php } ?>
</tbody>
</table>
<a <?php echo anchor('Send_all/index/'.$encoded_mail .'/'.$encoded_id , 'Send All', 'class="btn btn-info"');?></a>
</div>
</div>
</div>
</div>
</div>
Try below code it may help
$this->load->library('email');
$this->email->initialize($config);
replace your for each code
for($VendorEmail=0;$VendorEmail < count($cust_details);$VendorEmail++)
{}

How to POST dynamic input tags in codeigniter

I am facing a serious dilemma, and wondering how this would be possible. I have a form built in codeigniter framework. At the end of the form is an input tag which takes a number and appends a new form with exact rows of input tags as the value of the last input tag. I have done this using javascript, code is
$('#formName9').on('change', function() {
var selected = $(this).val();
$('#subForm').empty();
$("#subForm").append('<table border="" style="border:none; background:#f2f2f1; margin-bottom:10px; border-collapse: collapse; margin-top: 25px; box-shadow: 9px 4px 8px rgba(50, 50, 50, 0.75);" cellspacing="0" cellpadding="0"> <tr> <td style="text-align: center; width: 30px; border-width: 0px;"><img src="<?php echo base_url(); ?>assets/img/icon_house.png" ></td> <td style="text-align: center; border-width: 0px;"><img src="<?php echo base_url(); ?>assets/img/table_divider.png" /></td> <td style="text-align: center; width: 200px; border-width: 0px;"><strong>Unit Name</strong></td> <td style="text-align: center; border-width: 0px;"><img src="<?php echo base_url(); ?>assets/img/table_divider.png" /></td> <td style="text-align: center; width: 250px; border-width: 0px;" ><strong>Owner Name</strong></td> <td style="text-align: center; border-width: 0px;"><img src="<?php echo base_url(); ?>assets/img/table_divider.png" /></td> <td style="text-align: center;width: 150px; border-width: 0px;"><strong>Owner Salutation</strong></td> </tr> </table>');
for (var i=1; i<=selected; i++) {
$('#subForm').append('<div style="float: left; padding-left: 13px; padding-right: 12px; padding-top: 7px; margin-top: 0px;">'+i+'</div><input type="text" name="unitName" id="unitName'+i+'" style="width:189px;" required /><input type="text" name="ownerName'+i+'" id="ownerName'+i+'" style="width:241px;" /><input type="text" name="salutation'+i+'" id="salutation'+i+'" style="width:137px;" /><br />');
}
});
you can see i have used different naming conventions for all the appended tags according to the loop.
Now these values need to be posted in order for the PHP[SERVER] to do further work, but how will i post these dynamic values? i have tried to the following, but this just hangs my local server and doesn't go any further
$ownerName = array();
for ($i=0; $i<=$blockUnits ; $i+1) {
$ownerName[$i] = "ownerName".$i;
$this->input->post('ownerName[$i]');
}
While adding new input text boxes, give names for those fields as given below.
For example if user wants to add 5 fields, then the output will become something like
<input type="text" name="ownerName[]" />
<input type="text" name="ownerName[]" />
<input type="text" name="ownerName[]" />
<input type="text" name="ownerName[]" />
<input type="text" name="ownerName[]" />
Then in PHP you can get values of these fields like
$ownerNames = $_POST['ownerName'];
foreach( $ownerNames as $ownerName ) {
echo "Owner Name is : " . $ownerName;
}
As you are trying in CodeIgniter, the code will look something like this (getting post variable)
$ownerNames = $this->input->post('ownerName');
foreach( $ownerNames as $ownerName ) {
echo "Owner Name is : " . $ownerName;
}
i think it should be easier if you post your value in array ...
example..
<input type="text" name="ownerName[]" id="ownerName'+i+'" style="width:241px;" />
and loop it in controller...
foreach($this->input->post('ownerName') as test){
.....
}
similar for others

Show download file option on click [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
i need to show the download file option once the user fills the below email and name form -- Here is the form
<form action="process.php" method="post">
<input type="hidden" name="bot_action" value="form_subscribe" /> <input
type="hidden" name="bot_track_code" value="1" /> <input type="hidden"
name="bot_pass_standard" value="0" /> <input type="hidden"
name="bot_pass_custom" value="0" /> <input type="hidden"
name="bot_account" value="howtopossibleit" /> <input type="hidden"
name="bot_redirect" value="" /> <input type="hidden"
name="bot_web_form_id" value="44640" />
<table width="230" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="10" width="10%" align="left" valign="middle"></td>
<td height="10" width="28%" align="left" valign="middle"><div
style="font: bold 13px verdana, sans-serif; letter-spacing: -1px; color: #363636; margin: 0px 0px 0px 0px;">
<div align="center">Name:</div>
</div></td>
<td height="10" width="62%" align="left" valign="middle"><input
type="text"
style="width: 85%; margin: 0 auto; font: 10px verdana, sans-serif; height: 12px; line-height: 100%; padding: 2px 1px 1px 1px; border: 1px solid #363636; background: #ffffff url('http://images/form-input-bg.jpg') top left repeat-x;"
name="fullname" value="" /></td>
</tr>
<tr>
<td height="31" width="10%" align="left" valign="middle"></td>
<td height="15" width="28%" align="left" valign="middle"><div
style="font: bold 13px verdana, sans-serif; letter-spacing: -1px; color: #363636; margin: 0px 5px 0px 0px;">
<div align="center">Email:</div>
</div></td>
<td height="15" width="62%" align="left" valign="middle"><input
type="text"
style="width: 85%; margin: 0 auto; font: 10px verdana, sans-serif; height: 12px; line-height: 100%; padding: 2px 21x 1px 1px; border: 1px solid #363636; background: #ffffff url('http://images/form-input-bg.jpg') top left repeat-x;"
name="email" value="" /></td>
</tr>
<tr>
<td height="15" colspan="3" align="center" valign="middle"><table
style="border: 1px solid #363636;" cellpadding="0" cellspacing="0">
<tr style="background-color: #e8e8e8; color: #FFFFFF;">
<td width="234" height="26" align="center" bgcolor="#FF0000"
style="border-top: 1px solid #ffffff; border-left: 1px solid #ffffff;"><input
type="submit"
style="overflow: auto !important; overflow: visible; width: auto !important; width: 55px; margin: 0px 15px 0px 15px; border: 0px; background-color: #FF0000; font: bold 13px verdana, sans-serif; letter-spacing: -1px; color: #363636;"
name="submit2" value="SUBMIT, Than press Download" /></td>
</tr>
</table></td>
</tr>
<tr>
<td height="4" colspan="3" valign="middle"
style="padding: 3px 0px 3px 0px;"></td>
</tr>
</table>
</form>
Here is the download file code:
DownloadFile: <img width="32" height="32" title="Download File" src="images/downloadfile.png" alt="Download">
Set the code in a div and make it display:none initially..
<div id="link" style="display:none"> <img width="32" height="32" title="Download File" src="images/downloadfile.png" alt="Download"></div>
call this jquery function in onblur event of both name & email field
function enableLink() {
if($("#name").val() != "" && $("#email").val() != "")
$("#link").show();
else
$("#link").hide();
}

Categories