I need help to convert this code to codeigniter MVC
i have 2 file php
index.php for viewer and cari_barang.php for model
i have problem with file controller, I dont know how to get value post with ajax.
this my PHP code index.php
<html>
<head>
<script type="text/javascript" src="jquery-1.11.2.js"></script>
<script type='text/javascript' src='jquery.autocomplete.js'></script>
<script type="text/javascript">
$(document).ready(function() {
$("#barang").keyup(function() {
var kode = $('#barang').val();
$.ajax({
type : "POST",
data : "kode="+kode,
url : "cari_barang.php",
dataType: "json",
success: function(data){
$("#namabarang").val(data.namabarang);
$("#hargabeli").val(data.hargabeli);
}
});
});
});
</script>
</head>
<body>
<div class="demo" style="width: 450px;">
<div>
<p>Kode Barang : <input type="text" id="barang" value="0001"></p>
<p>Nama Barang : <input type="text" id="namabarang" size="50" disabled></p>
<p>Harga Beli : <input type="text" id="hargabeli" size="15" align="right" disabled></p>
</div>
</div>
</body>
</html>
this code for cari_barang.php
<?php
mysql_connect("localhost","root","");
mysql_select_db("barang");
$kode = $_POST['kode'];
$sql = mysql_query("select * from tbbarang where kodebarang='$kode'");
$row = mysql_num_rows($sql);
if($row>0){
$r = mysql_fetch_array($sql);
$data['namabarang'] = $r['namabarang'];
$data['hargabeli'] = $r['hargabeli'];
echo json_encode($data);
}else{
$data['namabarang'] = '';
$data['hargabeli'] = '';
echo json_encode($data);
}
?>
thanks before
have a look on codeigniter website http://www.codeigniter.com/userguide3/ hope you will find your solution.
if you convert your above code to codeigniter then its only a view file of codeigniter.
thanks all for answer,my problem solved with this code
Model :
public function get($kode)
{
$this->db->where('kodebarang',$kode);
$query = $this->db->get('tbbarang');
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
$data['namabarang'] = $row->namabarang;
$data['hargabeli'] = $row->hargabeli;
echo json_encode($data);
}
} else {
$data['namabarang'] = '';
$data['hargabeli'] = '';
echo json_encode($data);
}
}
Controller :
public function view()
{
$this->load->model('m_barang');
$kode = $this->input->post('kode');
//#$kode = $_POST['kode'];
$data = $this->m_barang->get($kode);
}
View :
<html>
<head>
<script type='text/javascript' src='<?php echo base_url("jquery-1.11.2.js");?>'></script>
<script type='text/javascript' src='<?php echo base_url("jquery.autocomplete.js");?>'></script>
<!-- <link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />
<link rel="stylesheet" href="main.css" type="text/css" /> -->
<script type="text/javascript">
$(document).ready(function() {
$("#barang").keyup(function() {
var kode = $('#barang').val();
$.ajax({
type : "POST",
data : "kode="+kode,
url : "<?=base_url('barang/view')?>",
dataType: "json",
success: function(data){
$("#namabarang").val(data.namabarang); //$r['namabarang']
$("#hargabeli").val(data.hargabeli); //$r['hargabeli']
}
});
});
});
</script>
</head>
<body>
<div class="demo" style="width: 450px;">
<div>
<p>Kode Barang : <input type="text" id="barang" value=""></p>
<p>Nama Barang : <input type="text" id="namabarang" size="50" disabled></p>
<p>Harga Beli : <input type="text" id="hargabeli" size="15" align="right" disabled></p>
</div>
</div>
<p class="footer" ><?php echo base_url();?></p>
<p class="footer" ><?php echo site_url();?></p>
<p class="footer" ><?php echo base_url('barang/view');?></p>
</body>
</html>
Related
So I have a chatting site in PHP, but the problem is that anyone can access any "chatroom". Is there a way to add an "Enter passcode" text box to the site before they are able to access the real thing? And if possible I would prefer not using those JavaScript pop-ups. And for the people who really want to help, I don't need any CSS.
My code:
index.php:
<?php
session_start();
if(isset($_GET['logout'])){
//Simple exit message
$logout_message = "<div class='msgln'><span class='left-info'>User <b class='user-name-left'>". $_SESSION['name'] ."</b> has left the chat session.</span><br></div>";
file_put_contents("log.html", $logout_message, FILE_APPEND | LOCK_EX);
session_destroy();
header("Location: ../../index.php"); //Redirect the user
}
if(isset($_POST['enter'])){
if($_POST['name'] != ""){
$_SESSION['name'] = stripslashes(htmlspecialchars($_POST['name']));
}
else{
echo '<span class="error">Please type in a name</span>';
}
}
function loginForm(){
echo
'<div id="loginform">
<p>Please enter your name to continue!</p>
<form action="index.php" method="post">
<label for="name">Name —</label>
<input type="text" name="name" id="name" />
<input type="submit" name="enter" id="enter" value="Enter" />
</form>
</div>';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title> Chat</title>
<meta name="description" content=" Chat Application" />
<link rel="stylesheet" href="../../css/chat.css" />
</head>
<body>
<?php
if(!isset($_SESSION['name'])){
loginForm();
}
else {
?>
<div id="wrapper">
<div id="menu">
<p class="welcome">Welcome, <b><?php echo $_SESSION['name']; ?></b></p>
<p class="logout"><a id="exit" href="#">Exit Chat</a></p>
</div>
<div id="chatbox">
<?php
if(file_exists("log.html") && filesize("log.html") > 0){
$contents = file_get_contents("log.html");
echo $contents;
}
?>
</div>
<form name="message" action="">
<input name="usermsg" type="text" id="usermsg" />
<input name="submitmsg" type="submit" id="submitmsg" value="Send" />
</form>
</div>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
// jQuery Document
$(document).ready(function () {
$("#submitmsg").click(function () {
var clientmsg = $("#usermsg").val();
$.post("post.php", { text: clientmsg });
$("#usermsg").val("");
return false;
});
function loadLog() {
var oldscrollHeight = $("#chatbox")[0].scrollHeight - 20; //Scroll height before the request
$.ajax({
url: "log.html",
cache: false,
success: function (html) {
$("#chatbox").html(html); //Insert chat log into the #chatbox div
//Auto-scroll
var newscrollHeight = $("#chatbox")[0].scrollHeight - 20; //Scroll height after the request
if(newscrollHeight > oldscrollHeight){
$("#chatbox").animate({ scrollTop: newscrollHeight }, 'normal'); //Autoscroll to bottom of div
}
}
});
}
setInterval (loadLog, 2500);
$("#exit").click(function () {
var exit = confirm("Are you sure you want to end the session?");
if (exit == true) {
window.location = "index.php?logout=true";
}
});
});
</script>
</body>
</html>
<?php
}
?>
post.php:
<?php
session_start();
if(isset($_SESSION['name'])){
$text = $_POST['text'];
$text_message = "<div class='msgln'><span class='chat-time'>".date("g:i A")."</span> <b class='user-name'>".$_SESSION['name']."</b> ".stripslashes(htmlspecialchars($text))."<br></div>";
file_put_contents("log.html", $text_message, FILE_APPEND | LOCK_EX);
}
?>
After inserting data into the database through jQuery/ajax, while fetching values from database without refresh the page how to display the database values using codeigniter?
This is my code:
Script:
<script>
$(document).ready(function(){
$("#personal-info").submit(function(e){
e.preventDefault();
var suppid = $("#suppid").val();
var proid = $("#proid").val();
var custid = $("#custid").val();
var message = $("#message").val();
$.ajax({
type: "POST",
url: "<?php echo base_url(); ?>index.php/Profile_cntrl/buyer_communication",
data: {suppid:suppid,proid:proid,custid:custid,message:message},
success:function(data)
{
alert('SUCCESS!!');
},
error:function()
{
alert('fail');
}
});
});
});
</script>
Controller:
public function buyer_communication() {
$result1 = $this->Profile_model->fetch_Data($product_id);
$Userid = $this->session->userdata('id');
$result3 = $this->session->userdata('tt');
$data4 = array(
'message' => $this->input->post('message'),
'supplier_id' => $this->input->post('suppid'),
'product_id' => $this->input->post('proid'),
'Customer_id' => $this->input->post('custid'),
'From' => $result3,
);
$this->Profile_model->buyer_insert($data4);
redirect('welcome/buyermessageview?id=' . $product_id);
}
Model:
function buyer_insert($data4) {
$this->db->insert('communication', $data4);
return ($this->db->affected_rows() != 1) ? false : true;
}
Form:
<form class="form-horizontal" method="POST" id="personal-info" role="form" action="#">
<div class="panel-footer">
<div class="input-group">
<input type ="hidden" name="suppid" id="suppid" value="<?php echo $row->supplier_id; ?>" class="form-control" />
<input type ="hidden" name="proid" id="proid" value="<?php echo $row->product_id; ?>" class="form-control" />
<input type ="hidden" name="custid" id="custid" value="<?php echo $row->Customer_id; ?>" class="form-control" />
<input id="message" name="message" type="text" class="form-control input-sm chat_input" placeholder="Write your message here..." />
<span class="input-group-btn">
<button class="btn btn-primary btn-sm" id="submit-p" name="submit-p">Send</button>
<!--<input type="submit" name="submit-p" id="submit-p" value="send" class="btn btn-primary btn-sm" >-->
</span>
</div>
</div>
</form>
#Maruthi Prasad here is the code.. [IN CODE IGNITER]
HTML view code with jquery script
views\profile_view.php
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-6">
<div id="load_data">
</div>
<form method="post" id="personal-info">
<input id="message" name="message" type="text" class="form-control input-sm chat_input" placeholder="Write your message here..." />
<button type="submit" class="btn btn-primary btn-sm" id="submit-p" name="submit-p">Send</button>
</form>
</div>
</div>
</div>
<script>
$(document).ready(function(){
loaddata();
data_submit();
});
function loaddata(){
$.getJSON('<?php echo base_url();?>'+'index.php/Profile_cntrl/get_data',function(data){
for(var i in data){
var show = '<div>';
show += '<h5 style="background:#ccc;padding:10px;border-radius:10px;">'+data[i].message+'</h5>';
show += '</div>';
$("#load_data").append(show);
}
});
}
function data_submit(){
$("#personal-info").submit(function(e){
e.preventDefault();
var formdata = $(this).serialize();
$.ajax({
type:'POST',
url:'<?php echo base_url();?>'+'index.php/Profile_cntrl/insert_data',
data:formdata,
success:function(data){
var res = JSON.parse(data);
if(res.Status == 'true'){
//console.log(res.report);
$("#load_data").empty();
loaddata()
}else{
alert(res.report);
}
}
});
});
}
</script>
</body>
</html>
CONTROLLER CODE:
controllers\Profile_cntrl.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
header('Access-Control-Allow-Origin: *');
class Profile_cntrl extends CI_Controller {
function __construct(){
parent::__construct();
$this->load->model('profile_model');
$this->load->helper(array('url','html','form'));
}
public function index()
{
$this->load->view('profile_view');
}
public function get_data(){
$query = $this->profile_model->buyer_communication();
echo json_encode($query);
}
public function insert_data(){
$arr = array(
'message'=>$this->input->post('message')
);
$sql = $this->profile_model->buyer_insert($arr);
$op = "data insert id :".$this->db->insert_id();
if($sql == true){
$reponse = array(
'Status'=>'true',
'report'=>$op
);
echo json_encode($reponse);
}
else
{
$op = "Failed to insert data";
$reponse = array(
'Status'=>'false',
'report'=>$op
);
echo json_encode($reponse);
}
}
}
?>
Model code:
models\Profile_model.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Profile_model extends CI_model {
public function buyer_communication(){
$sql = $this->db->get('communication');
$sql = $sql->result_array();
return $sql;
}
public function buyer_insert($arr){
return $query = $this->db->insert('communication',$arr);
}
}
?>
Feel free to ask questions
I'm writing a chat script but I have problem with echo some variables!
I have written this piece of code in chat.php to show the messages:
<?php
session_start();
$id=$_GET['id'];
if(isset($id)){
global $id;
global $qs;
global $answerer;
global $sp;
global $name;
include('config.php');
$conn=new PDO("mysql:host=$servername;dbname=$dbname;charset=utf8;",$username,$password);
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$id=$conn->quote(htmlentities($id));
$find=$conn->prepare("SELECT * FROM qs WHERE id=:id");
$find->bindParam(':id',$id);
$find->execute();
if($rows=$find->fetch(PDO::FETCH_ASSOC)){
$qs=$rows['question'];
$answerer=$rows['answerer'];
}
$answerer=explode("(",$answerer);
$ansgiver=$conn->prepare("SELECT * FROM ruhani WHERE name=:answerer");
$ansgiver->bindParam(':answerer',$answerer[0]);
$ansgiver->execute();
if($row=$ansgiver->fetch(PDO::FETCH_ASSOC)){
$name=$row['username'];
$avatar=$row['avatar'];
$sp=$row['sp'];
}
class chat {
public function fetchMessage() {
include('config.php');
global $id;
$conn=new PDO("mysql:host=$servername;dbname=$dbname;charset=utf8;",$username,$password);
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$ans=$conn->prepare("SELECT answere FROM ans WHERE q_id=:id ");
$ans->bindParam(':id',$id);
$ans->execute();
}
public function throwMessage($id, $text,$sayer){
include('config.php');
global $id;
$conn=new PDO("mysql:host=$servername;dbname=$dbname;charset=utf8;",$username,$password);
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
$send=$conn->prepare("INSERT INTO ans(q_id,answere,sayer) VALUES(:q_id,:text,:sayer) ");
$send->bindParam(':q_id',$id);
$send->bindParam(':text',$text);
$send->bindParam(':sayer',$sayer);
$send->execute();
}
}
$chat = new chat();
?>
<!DOCTYPE html>
<head>
<title>Example Title</title>
<meta charset="utf-8">
<link rel="stylesheet" href="style/style.css" media="screen, projection" />
<script src="js/jquery-1.6.3.min.js"></script>
<script src="js/chat.js"></script>
</head>
<body>
<div class="all">
<div class="env">
<span><?php echo $name ?>|<?php echo $sp ?></span>
<span>Hi,Can I help you?</span><br>
<span>me:<?php echo $qs ?></span>
<div class="messages"></div>
</div>
<textarea name="ask_ans" class="ask_ans" id="ask_ans" placeholder="Please write here!"></textarea><br>
<input type="submit" class="submit" name="submit" value="send" />
<input type="hidden" id="hidden" value=<? echo $id ?> />
<input type="hidden" id="hidden2" value=<? echo $_SESSION['$username'] ?> />
</div>
</body>
<?php
}
?>
and this code for Ajax part(chat.js):
var chat = { }
chat.fetchMessage=function (){
$.ajax({
url:"send.php",
type: 'POST',
data: {method : 'fetch'},
cache:false,
success: function(data){
$(".all .env .messages").html(data)
}
});
}
chat.throwMessage=function (id,message,sayer){
if($.trim(message).length != 0 ){
$.ajax({
url:"send.php",
type: 'POST',
data: {method : 'throw' , id : id , message : message , sayer : sayer },
cache:false,
success: function(data){
chat.fetchMessage();
$(".ask_ans").val('');
}
});
}
}
chat.entry=$(".all .submit");
chat.entry.bind('click',function (evt){
evt.preventDefault();
chat.throwMessage($("#hidden").val(),$(".ask_ans").val(),$("#hidden2").val());
});
chat.interval=setInterval(chat.fetchMessage(),5000);
chat.fetchMessage()
And this is send.php:
<?php
require('chat.php');
if (isset($_POST['method']) and !empty($_POST['method'])){
$chat =new chat();
$method =trim($_POST['method']);
if ($method === 'fetch'){
$messages=$chat->fetchMessage();
if (!empty($messages)){
while($r=$messages->fetch(PDO::FETCH_ASSOC)){
$sayer=$r['sayer'];
if($sayer===$starter){
?>
<span class="text" style="float:left"><? echo $r['answere'] ?></span>
<?php
}else{
?>
<span class="text" style="float:right"><? echo $r['answere'] ?></span>
<?php
}
}
}
}else if ($method === 'throw'){
$message=trim(htmlentities($_POST['message']));
$id=trim(htmlentities($_POST['id']));
$sayer=trim(htmlentities($_POST['sayer']));
if(!empty($message) and !empty($id) and !empty($sayer)){
$chat->throwMessage($id,$message,$sayer);
}
}
}
?>
I am getting an error:
Undefined index:id
My problem is that I can't echo $qs,$name,$sp in chat.php.
Can anyone understand the wrong part of my code?
After long time I checked my code,I understand the problem:)
As you see I'm using PDO::quote() and it puts ' ' over the word.So that When I was exploding the variable here:$answerer=explode("(",$answerer);,it couldn't find the correct word to search in DB and didn't echo the variable.
And now I have deleted PDO::quote() and my code is working correct.:-)
this is my file php use jquery to send text from view to send_message.php based only for one id. i want change this code become send text from view to send_message.php to all id registered. you can see this code
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
});
function sendPushNotification(id){
var data = $('form#'+id).serialize();
$('form#'+id).unbind('submit');
$.ajax({
url: "send_message.php",
type: 'GET',
data: data,
beforeSend: function() {
},
success: function(data, textStatus, xhr) {
$('.txt_message').val("");
},
error: function(xhr, textStatus, errorThrown) {
}
});
return false;
}
</script>
</head>
<body>
<?php
include_once 'db_functions.php';
$db = new DB_Functions();
$users = $db->getAllUsers();
if ($users != false)
$no_of_users = mysql_num_rows($users);
else
$no_of_users = 0;
?>
<div class="container">
<h1>No of Devices Registered: <?php echo $no_of_users; ?></h1>
<hr/>
<ul class="devices">
<?php
if ($no_of_users > 0) {
?>
<?php
while ($row = mysql_fetch_array($users)) {
?>
<li>
<form id="<?php echo $row["id"] ?>" name="" method="post" onsubmit="return sendPushNotification('<?php echo $row["id"] ?>')">
<label>Name: </label> <span><?php echo $row["name"] ?></span>
<div class="clear"></div>
<label>Email:</label> <span><?php echo $row["email"] ?></span>
<div class="clear"></div>
<div class="send_container">
<textarea rows="3" name="message" cols="25" class="txt_message" placeholder="Type message here"></textarea>
<input type="hidden" name="regId" value="<?php echo $row["gcm_regid"]; ?>"/>
<input type="submit" class="send_btn" value="Send" onclick=""/>
</div>
</form>
</li>
<?php } ?>
<?php
} else { ?>
<li>
No Users Registered Yet!
</li>
<?php } ?>
</ul>
</div>
</body>
</html>
this code send input from "txt_message" to user based id and "gcm_regid" so one txt_message for one id, but i try to send same txt_message for multiple id. help me, thank yuo
print_r($_REQUEST) is not showing all the datas after redirecting from a page from which form is being submitted. In the redirected page it is showing some datas but not all.In the localhost all the requested datas are showing fine,but in the server the problem is occurring.
I have created a php.ini & put max_execution_time = 160; post_max_size = 250M; into the file & uploaded it in the server. But still couldn't get any solution.
Here is code. Actually some page are included after checking condition and then the form is being submitted after filling fields.
include("configuration.php");
if(isset($_REQUEST["save_update"]) && $_REQUEST["save_update"]!="")
{
include("quotation_save.php");
header("location:http://mpsinfoservices.com/projects/topline/quotation.php?enquiry_id=".$_REQUEST["enquiry_id"]."&displaying_id=".$_REQUEST["displaying_id"]);
}
$enqid = $_REQUEST["enquiry_id"];
$displaying_id = $_REQUEST["displaying_id"];
$len_of_disp = strlen($displaying_id);
/*if(preg_match('/E/',$displaying_id))
{
echo substr($displaying_id,0,6);
echo "<br/>".substr($displaying_id,strlen(substr($displaying_id,0,6)));
if(preg_match('/F/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
$ch_from_find_str = 'F';
$find_str = substr($displaying_id,0,7);
$ch_from_find_str = substr($find_str,6,1);
}
if(preg_match('/PKG/',$displaying_id))
{
$find_str = substr($displaying_id,0,9);
echo $find_str;
}
*/
$sql_enquiry = mysql_query("SELECT * FROM `enquiry_master` WHERE `id`='".$enqid."' AND `displaying_id`='".$displaying_id."'");
$row_enquiry = mysql_fetch_assoc($sql_enquiry);
$sql_client_info = mysql_query("SELECT * FROM `client_info` WHERE `client_id`='".$row_enquiry['customer_id']."'");
$row_client_info = mysql_fetch_assoc($sql_client_info);
?>
<link type="text/css" href="css/cupertino/jquery-ui-1.8.21.custom.css" rel="stylesheet" />
<link type="text/css" href="css/jquery.dataTables_themeroller.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="js/function.js"></script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<link type="text/css" href="css/style.css" rel="stylesheet">
<style>
.client_name
{
border:none;
}
.client_name_mouseover
{
border:1px solid #000;
}
</style>
</head>
<body>
<?php include("includes/header.php"); ?>
<div id="page-container">
<?php
include("includes/left_menu.php");
?>
<div id="page_content" style="float:left;">
<div style="margin-top:25px;">
<div style="padding-top:10px;">
<div style="color:#000;font-weight:bold;font-size:12px;font-family:verdana;">Client Details</div>
<div>Name:- <input type="text" name="client_name" id="client_name" class="client_name" value="<?php echo $row_client_info["client_firstname"].$row_client_info["client_middlename"].$row_client_info["client_lastname"];?>" readonly="readonly"/></div>
<div>Email:- <?php echo $row_client_info["client_email_id"]; ?>
</div>
<div>
<?php
$sql_quotation_insert_status = mysql_query("SELECT `status` FROM `quotation_insert_status` WHERE `enquiry_id`='".$enqid."'");
if( mysql_num_rows($sql_quotation_insert_status)>0)
{
$res_quotation_insert_status = "insert";
}
else
{
$res_quotation_insert_status = "";
}
?>
<form name="quotation" class="quotationfrm" method="post" enctype="multipart/form-data" action="quotation.php">
<input type="hidden" name="displaying_id" value="<?php echo $displaying_id; ?>"/>
<input type="hidden" name="enquiry_id" value="<?php echo $enqid; ?>"/>
<input type="hidden" name="save_update" <?php if($res_quotation_insert_status=="insert"){?>value="update" <?php } if($res_quotation_insert_status==""){?> value="save_quotation" <?php } ?>/>
<?php
if(preg_match('/E/',$displaying_id))
{
if(preg_match('/F/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/flight_quotation.php");
}
if(preg_match('/T/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/train_quotation.php");
}
if(preg_match('/H/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/hotel_quotation2.php");
}
if(preg_match('/CC/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/carrental_quotation.php");
}
if(preg_match('/I/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/insurance_quotation.php");
}
if(preg_match('/V/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/visa_quotation.php");
}
if(preg_match('/CR/',substr($displaying_id,strlen(substr($displaying_id,0,6)))))
{
include("quotation/cruise_quotation.php");
}
}
if(preg_match('/PKG/',$displaying_id))
{
if(preg_match('/H/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/hotel_quotation2.php");
}
include("quotation/package_quotation.php");
if(preg_match('/F/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/flight_quotation.php");
}
if(preg_match('/V/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/visa_quotation.php");
}
if(preg_match('/T/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/train_quotation.php");
}
if(preg_match('/CC/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/carrental_quotation.php");
}
if(preg_match('/I/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/insurance_quotation.php");
}
if(preg_match('/CR/',substr($displaying_id,strlen(substr($displaying_id,0,7)))))
{
include("quotation/cruise_quotation.php");
}
}
?>
<input type="button" class="save_quotation" <?php if($res_quotation_insert_status=="insert"){?> value="Update" <?php } if($res_quotation_insert_status==""){ ?> value="Save The Quotation" <?php } ?> style="margin-top:20px;" <?php if($res_quotation_insert_status=="insert"){ ?> name="save" <?php } if($res_quotation_insert_status==""){ ?> name="update" <?php } ?>/>
<?php if($res_quotation_insert_status=="insert"){?>
<input type="button" class="sendQuotation" value="Send Quotation"/>
<?php
}
?>
</form>
</div>
</div>
<script>
$(function(){
var no=0;
$("form").each(function(){
no++;
});
var suc = 0;
$("#client_name").live("mouseover",function(){
$(this).removeClass("client_name");
$(this).addClass("client_name_mouseover");
});
$("#client_name").live("mouseout",function(){
$(this).removeClass("client_name_mouseover");
$(this).addClass("client_name");
});
$(".mail_to_client").live("click",function(){
$.post("flight_quotation_mail.php?enquiry_id=<?php echo $enqid; ?>",$(".flight_quotation_frm").serialize(),function(data){
if(data=="success")
{
suc++;
}
if(no==suc)
{
$.post("mail_to_client.php?enquiry_id=<?php echo $enqid; ?>");
}
});
$.post("train_quotation_mail.php?enquiry_id=<?php echo $enqid; ?>",$(".train_quotation_frm").serialize(),function(data){
if(data=="success")
{
suc++;
}
if(no==suc)
{
$.post("mail_to_client.php?enquiry_id=<?php echo $enqid; ?>");
}
});
/*$.post("hotel_quotation_mail.php?enquiry_id=<?php echo $enqid; ?>",$(".hotel_quotation_frm").serialize(),function(data){
if(data=="success")
{
suc++;
}
if(no==suc)
{
$.post("mail_to_client.php?enquiry_id=<?php echo $enqid; ?>");
}
});*/
});
$(".save_quotation").live("click",function(){
$(".quotationfrm").submit();
});
$(".sendQuotation").live("click",function(){
for(var instanceName in CKEDITOR.instances)
CKEDITOR.instances[instanceName].updateElement();
var formData = $(".quotationfrm").serialize();
$.post("quotation_pdf.php",function(){
window.open("quotation_pdf.php?"+formData);
});
});
});
</script>
In some cases due to html elements in the data it will render only few, try checking View Source of that page.
The content and order of $_REQUEST is affected by variables_order directive in php.ini (see Description of core php.ini directives)
So, it is possible, that on your production environment value of variables-order directive differs from that in your development environment (localhost).
For example, set variables_order = "GPCS" in order to have G-$_GET, P-$_POST, C-$_COOKIE, S-$_SERVER arrays and all values from that arrays in $_REQUEST.