I want to create custom repeater controller for theme, for this i tried but i am stuck with issue and i am unable to save any changes to my repeater section, any help is highly appreciated, here is link to my code
The code for customizer class is
if (class_exists('WP_Customize_Control')):
class Test_Testimonial_Control extends WP_Customize_Control {
public $type = 'textarea';
public function render_content() {
?>
<div class="test-rep-section-wrap">
<div class="test-rep-section">
<h3 class="test-title"><?php echo esc_html( $this->label ); ?></h3>
<div class="test-contents">
<input type="text" name="testimonial" placeholder="Image URL" id="img-link-testimonial">
Upload Image
<span><?php _e('Description Text','text-domain'); ?></span>
<textarea rows="2" style="width:100%;"><?php echo esc_textarea( $this->value() ); ?></textarea>
<input type="text" name="cl_name" placeholder="Name">
</div>
Add More
<input <?php $this->link(); ?> type="hidden" value="<?php echo esc_attr($this->value()); ?>"/>
</div>
</div>
<?php
}
}
endif;
jquery code is
$('.test-contents').hide();
$('body').on('click', '.test-title', function(){
$('.test-contents').slideToggle();
});
$('body').on('click', '.new_section', function(){
var tCount = 0;
$('.test-rep-section-wrap').append('<div class="test-rep-section"><h3 class="test-title">Testimonial Options</h3><div class="test-contents" style="display: block;"><input type="text" name="testimonial" placeholder="Image URL" id="img-link-testimonial">Upload Image<span>Description Text</span><textarea rows="5" style="width:100%;"></textarea><input type="text" name="cl_name" placeholder="Name"></div>Add More<input data-customize-setting-link="ripple_pro_testimonial_repeater" type="hidden" value=""><div class="delete-test-feature">Delete Feature</div></div>');
});
$(document).on('click', '.delete-test-feature > a', function(){
$(this).parents('.test-rep-section').remove();
});
Related
I have created a simple form type page as follows,
<form action="" method="GET" >
<div class="input-group mb-3">
<input type="text" name="search" required value="<?php if(isset($_GET['search'])){echo $_GET['search']; } ?>" class="form-control" placeholder="Search data">
<button type="submit" class="btn btn-primary">Search</button>
</div>
</form>
I need to type a text in search box(name ="search") and after clicking submit I need to filter the sql data as follows.
<?php
$con = mysqli_connect("10.62.96.133", "root", "", "cdrextend");
if(isset($_GET['search']))
{
$filtervalues = $_GET['search'];
$query="***";
$query_run = mysqli_query($con, $query);
if(mysqli_num_rows($query_run) > 0)
{
foreach($query_run as $items)
{
?>
<tr>
<td><?= $items['***']; ?></td>
<td><?= $items['***']; ?></td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td colspan="2">No Record Found</td>
</tr>
<?php
}
}
?>
Whenever I hit submit button after typing something in text box, it redirects to login page and I am not getting any results.Can someone show me where I have messed up?
Hi change your forms submit action="" to action="<?php echo htmlspecialchars($_SERVER[" PHP_SELF "]);?>"
<form action="<?php echo htmlspecialchars($_SERVER[" PHP_SELF "]);?>" method="GET" >
<div class="input-group mb-3">
<input type="text" name="search" required value="<?php if(isset($_GET['search'])){echo $_GET['search']; } ?>" class="form-control" placeholder="Search data">
<button type="submit" class="btn btn-primary">Search</button>
</div>
</form>
the website hoster upgraded tot php 7
the code
else{
$insert="Insert into voedselinfo(voedselnaam,Eenheid,Kcal,Eiwit,Koolh,Vet)
values('".$voedselnaam."','".$Eenheid."','".$Kcal."','".$Eiwit."','".$Vet."','".$Koolh."')";
$rs=mysql_query($insert) or die(mysql_error());
?>
<script>alert('Data Entry Saved!');</script>
<?php }
}
}
?>
does not work anymore....
should it be?
else{
$insert="Insert into voedselinfo(voedselnaam,Eenheid,Kcal,Eiwit,Koolh,Vet)
values('".$voedselnaam."','".$Eenheid."','".$Kcal."','".$Eiwit."','".$Vet."','".$Koolh."')";
$rs=mysqli_query($insert) or die(mysqli_error());
?>
<script>alert('Data Entry Saved!');</script>
<?php }
}
}
?>
but doesn't seem to work either, the alert doesn't show up anymore, nothing happens...
<!DOCTYPE html>
<head>
<title>Voedsel toevoegen bug 6</title>
<!-- Bootstrap -->
<link href="css/bootstrap.css" rel="stylesheet">
<script src="js/bootstrap.min.js"></script>
</head>
<body>
<br><br>
<h3>Controleer dat de waarden correct naar het overzicht (View Data) worden overgezet.<h3>
<div class="left">
<form class="span4" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<fieldset>
<legend>Voedsel toevoegen</legend>
<label>voedselnaam<span class="required">*</span></label>
<input type="text" name="voedselnaam" class="input-xlarge" placeholder="voedselnaam" value="<?php if(isset($_POST['voedselnaam'])){ echo $_POST['voedselnaam']; }?>" autofocus>
<label>Eenheid<span class="required">*</span></label>
<input type="text" name="Eenheid" class="input-small" placeholder="" value="<?php if(isset($_POST['Eenheid'])){ echo $_POST['Eenheid']; }?>">
<br/>
<label>Kcal<span class="required">*</span></label>
<input type="text" name="Kcal" class="input-small" placeholder="" value="<?php if(isset($_POST['Kcal'])){ echo $_POST['Kcal']; }?>">
<br/>
<label>Eiwitten<span class="required">*</span></label>
<input type="text" name="Eiwit" class="input-small" placeholder="" value="<?php if(isset($_POST['Eiwit'])){ echo $_POST['Eiwit']; }?>">
<br/>
<label>Koolh.<span class="required">*</span></label>
<input type="text" name="Koolh" class="input-small" placeholder="" value="<?php if(isset($_POST['Koolh'])){ echo $_POST['Koolh']; }?>">
<br/>
<label>Vet<span class="required">*</span></label>
<input type="text" name="Vet" class="input-small" placeholder="" value="<?php if(isset($_POST['Vet'])){ echo $_POST['Vet']; }?>">
<?php
if(isset($_POST['getdata'])){
$conn=mysqli_connect('localhost','masked','masked01');
mysqli_select_db("database",$conn);
// $regexp = "/^[^0-9][A-z0-9_]+([.][A-z0-9_]+)*[#][A-z0-9_]+([.][A-z0-9_]+)*[.][A-z]{2,4}$/";
$voedselnaam=$_POST['voedselnaam'];
$Eenheid=$_POST['Eenheid'];
$Kcal=$_POST['Kcal'];
$Eiwit=$_POST['Eiwit'];
$Koolh.=$_POST['Koolh'];
$Vet=$_POST['Vet'];
$var=mt_rand(0,1);
if($var == 1 || 0) {
if($Vet >15 && $Eiwit >10)
{
echo "<label class='err'>You found bug#3: The system crashes by testing this way. Great Job!</label>";
}
elseif($Vet ==15 && $Eiwit ==10)
{
echo "<label class='err'>You found bug#4: Boundry value analyses. (only in combination of both boundry) Great Job!</label>";
}
elseif($Vet >15)
{
echo "<label class='err'>You found bug#2: Fat bigger then 15</label>";
}
elseif($Eiwit >10)
{
echo "<label class='err'>You found bug#1: Eiwit bigger then 10 </label>";
}
else{
$insert="Insert into voedselinfo(voedselnaam,Eenheid,Kcal,Eiwit,Koolh,Vet)
values('".$voedselnaam."','".$Eenheid."','".$Kcal."','".$Eiwit."','".$Vet."','".$Koolh."')";
$rs=mysql_query($insert) or die(mysql_error());
?>
<script>alert('Data Entry Saved!');</script>
<?php }
}
}
?>
<br/> <button type="submit" name="getdata" class="btn">Submit</button>
View Data
</fieldset>
</form>
</div>
<?php
function save(){
}
?>
</body>
</html>
I am working in a project with codeigniter and bootstrap, I made an autocomplete system, but the css looks broken like this
https://gyazo.com/4af7ae2bbdfd5547233d192b80ef947e
There is no custom style, only the bootstrap min css, here is my view html code, any help to look like it should be would be appreciated
<h2>Welcome to Crossover Laboratory</h2>
<div class="row">
<div class="col-md-1">
</div>
<div class='col-md-10 text-center'>
<h3>Patients</h3>
<?php echo $error2; ?>
<?php
$attributes2 = array(
"class"=>"form-horizontal",
"id" => "LoginForm2",
"name" => "LoginForm2",
"method" => "post"
);
echo form_open("laboratory/patients", $attributes2); ?>
<div class="form-group">
<input type="text" name="username_patients" id="username_patients" class="ui-autocomplete-input" value="" required placeholder="Name" />
<p id="patient_name"></p>
</div>
<div class="form-group">
<input type="password" name="password_patients" id="password_patients" value="" required placeholder="Code"/>
</div>
<div class="form-group">
<?php echo form_submit("Login2","Login"); ?>
</div>
<?php echo form_close(); ?>
</div>
<div class="col-md-1">
</div>
</div>
<script type="text/javascript">
$(document).ready(function($) {
$("#username_patients").autocomplete({
source: '<?php echo site_url('laboratory/autocomplete'); ?>',
minlenght: 2,
html: true,
open: function(event, ui)
{
$(".ui-autocomplete").css("z-index",1000);
}
});
});
</script>
I think you have missed the jQueryUI CSS references. Add the below CSS in your application <head> section and try..
<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
hello I'm try to insert file in database but don't working
file which I'm upload gives the value 0 in my coloumn lampiran in database
and not file in folder to store my upload
database
id|npp|tgl_pengajuan|ket|status|lampiran|lama|tgl_mulai|tgl_selesai | id_jenis
controller
class Cutidiluar extends CI_Controller {
var $limit=10;
var $offset=10;
var $gallery_path;
var $gallery_path_url;
public function __construct(){
parent::__construct();
$this->gallery_path = realpath(APPPATH . '../asset');
$this->gallery_path_url = base_url().'asset/';
} public function add()
{ if($this->session->userdata('LOGIN')=='TRUE')
{
$this->load->library('form_validation');
$this->load->model('Diluartahunan_Model');
//load uploading file library
$config['upload_path'] = './asset/';
$config['allowed_types'] = 'jpg|png|pdf|jpeg|word';
$this->load->library('upload',$config);
$this->upload->do_upload();
$this->upload->data();
$this->form_validation->set_rules('ket', 'ket');
$this->form_validation->set_rules('lama', 'lama');
$this->form_validation->set_rules('lampiran', 'lampiran');
if ($this->form_validation->run() == false) {
$data['nama'] = $this->Diluartahunan_Model->nama();
$data['view'] = 'Cutidiluar/add';
$data['judul']='';
$this->load->view('index',$data);
}else {
$this->load->model('Cutidiluar_Model');
$this->Cutidiluar_Model->add();
redirect('Cutidiluar');
} }}
Model
public function add() {
$npp = $this->session->userdata('NPP');
$id_jenis = $this->input->post('id_jenis');
$ket = $this->input->post('ket');
$lama = $this->input->post('lama');
$tgl_selesai= date('Y-m-d',strtotime($this->input->post('tgl_selesai')));
$tgl_mulai= date('Y-m-d', strtotime($this->input->post('tgl_mulai')));
$lampiran = $this->input->post('lampiran');
$data = array(
'npp'=> $npp,
'id_jenis'=> $id_jenis,
'tgl_pengajuan' => date('y-m-d'),
'ket' => $ket,
'status' => 'P',
'lampiran'=> $lampiran,
'lama'=> $lama,
'tgl_mulai'=> $tgl_mulai,
'tgl_selesai'=> $tgl_selesai,);
$this->db->insert('Cuti_diluar', $data);}
view
<link rel="stylesheet" href="<?php echo base_url();?>css/themes/jquery.ui.all.css" type="text/css" />
<script>
$(document).ready(function() {
$( ".datepicker" ).datepicker();
});
function save(){
$.ajax({
url:'<?php echo base_url(); ?>Cutidiluar/add/',
type:'POST',
data:$('#frmsave').serialize(),
success:function(data){
if(data!=''){
$( "#infodlg" ).html(data);
$( "#infodlg" ).dialog({ title:"Info...", draggable: false});
} else {
window.location="<?php echo base_url() ?>Cutidiluar";
} } }); }
function confirmdlg(){
$("#confirm").dialog({
resizable: false,
modal: true,
title:"Info...",
draggable: false,
width: 'auto',
height: 'auto',
buttons: {
"Ya": function(){
save();
$(this).dialog("close");
window.location="<?php echo base_url() ?>Cutidiluar";
},
"Tutup": function(){
$(this).dialog("close");
}
}
});
}
</script>
<div class="span6">
<div class="well grey">
<div class="well-header">
<h5>Tambah Cuti </h5>
</div>
<div class="well-content no-search">
<form id="frmsave" name="frmsave" class="form-validate" >
<form id="frmsave" name="frmsave" class="form-validate">
<h3>Detail </h3>
<div class="form_row">
<label class="field_name">Pilih cuti</label>
<div class="field">
<?php foreach ($nama->result() as $valnama) { ?>
<input type="radio" name="id_jenis" value="<?php echo $valnama->id_jenis; ?>"> <?php echo $valnama->nama ?></br></br> <?php } ?>
</div>
</div>
<div class="form_row">
<label class="field_name">Tanggal Pengambilan Cuti</label>
<div class="field">
<input placeholder="TANGGAL MULAI CUTI" class="datepicker" size="16" type="text" name="tgl_mulai" id="tgl_mulai" value="<?php echo set_value('tgl_mulai'); ?>" >
<input placeholder="TANGGAL SELESAI CUTI" class="datepicker" size="16" type="text" name="tgl_selesai" id="tgl_selesai" value="<?php echo set_value('tgl_selesai'); ?>" >
</div>
</div>
<div class="form_row">
<label class="field_name">lama</label>
<div class="field">
<input type="text" name="lama" class="input-large" value="<?php echo set_value('lama'); ?>" placeholder="masukan lama cuti">
</div>
</div>
<div class="form_row">
<label class="field_name">Lampiran</label>
<div class="field">
<input type="file" name="userfile">
</div>
</div>
<div class="form_row">
<label class="field_name">Keterangan (MAKS 50 KARAKTER)</label>
<div class="field">
<textarea placeholder="KETERANGAN CUTI" id="ket" name="ket" class="span12" cols="40" rows="5" value="<?php echo set_value('ket'); ?>"></textarea>
</div>
</div>
<div class="form_row">
<div class="field">
<a onclick="return confirmdlg()" class="blue btn">Submit</a>
Cancel
</div>
</div>
</form>
I have change my view and model
in view
<form id="frmsave" name="frmsave" class="form-validate" enctype="multipart/form-data" >
and this my model
public function add() {
$npp = $this->session->userdata('NPP');
$id_jenis = $this->input->post('id_jenis');
$ket = $this->input->post('ket');
$lama = $this->input->post('lama');
$tgl_selesai= date('Y-m-d', strtotime($this->input->post('tgl_selesai')));
$tgl_mulai= date('Y-m-d', strtotime($this->input->post('tgl_mulai')));
$lampiran = $_FILES['userfile']['name'];
$data = array(
'npp'=> $npp,
'id_jenis'=> $id_jenis,
'tgl_pengajuan' => date('y-m-d'),
'ket' => $ket,
'status' => 'P',
'lampiran'=> $lampiran,
'lama'=> $lama,
'tgl_mulai'=> $tgl_mulai,
'tgl_selesai'=> $tgl_selesai);
and result can't insert to my database
The upload process must be done after the validation, and use $this->upload->display_errors() to see what's wrong :
$this->form_validation->run() === TRUE) {
$this->load->library('upload');
$this->upload->initialize($config);
if (!$this->upload->do_upload()){
$data['errors'] = $this->upload->display_errors(); // <-- HERE
$this->load->view('index', $data);
}
else{
$upload_data = $this->upload->data();
$this->load->model('Cutidiluar_Model');
$this->Cutidiluar_Model->add();
}
I have the following shortcode. What I would like to do is turn this shortcode into a sidebar area so that I can run a decent contact widget. I have googled and tried a few tutorials but I cannot get it working.
Index.php
<?php
$classes = '';
if (strtolower($menuItem->title) == $precision_contact_page) {
?>
<div id="<?php echo strtolower($menuItem->title); ?>scroller">
<?php
$page_data = get_page($menuItem->page_id);
echo do_shortcode($page_data->post_content);
?>
Functions.php:
//contactform shortcode
function contactform_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'class' => 'content'
), $atts ) );
$returncontent = '<div class="' . esc_attr($class) . '">';
$returncontent .= 'ContactInformation
<h5>Get In Touch</h5><div id="contactform">
<div id="response"></div>
<form id="precision-contact-form" method="POST" action="" class="form">
<div id="main">
<p class="name">
<input type="text" name="uname" id="uname" />
<label for="uname" class="overlabel">Name</label>
</p>
<p class="email">
<input type="text" name="uemail" id="uemail" />
<label for="uemail" class="overlabel">E-mail</label>
</p>
<p class="text">
<textarea name="ucomments" id="ucomments" ></textarea>
</p>
<p class="submit">
<button type="submit" name="submit" id="submit" class="graybutton">Send Email</button>
</p>
</div><!--end main-->
</form>
</div><!--end contact form-->';
$returncontent .= '</div>';
return $returncontent;
}
add_shortcode('contactform', 'contactform_shortcode');
?>
Past this where you want in side bar
<?php echo do_shortcode('[contactform']'); ?>
If you want your shortcode to work in the side bar then you can do the following.
in functions.php add the following
add_filter('widget_text', 'do_shortcode');
This will run all your text widget's content through the *do_shortcode* function.
You can now add a new text widget to your sidebar and use your shortcode inside it, just as if you were in the post edit screen.
[contactform]