I have an codeigniter based website. I am trying to output user information to print out a shipping label for them. Everything works okay however the information that is displayed in the new pop out window is not in the right format and one of the parameters is coming up as undefined. The code I am using is below:
from admin_controller.php
public function address(){
$data['Address']=$this->input->get("Address");
$data['firstname']=$this->input->get("firstname");
$data['lastname']=$this->input->get("lastname");
$data['address1']=$this->input->get("address1");
$data['address2']=$this->input->get("address2");
$data['suburb']=$this->input->get("suburb");
$data['state']=$this->input->get("state");
$data['postcode']=$this->input->get("postcode");
$data['mobile']=$this->input->get("mobile");
$this->load->view('admin/address',$data);
}
Code related to the button itself
<a class="btn btn-primary" href="#" onClick="Address('<?php echo $order->firstname ?>','<?php echo $order->lastname ?>','<?php echo $order->address1 ?>','<?php echo $order->address2 ?>','<?php echo $order->suburb ?>','<?php echo $order->state ?>','<?php echo $order->postcode ?>','<?php echo $order->mobile ?>')"> Label </a>
The Script
<script>
function Address(val,firstname,lastname,address1,address2,suburb,state,postcode,mobile){
window.open("<?php echo base_url();?>admin_controller/address?Address="+val+"&firstname="+firstname+"&lastname="+lastname+"&address1="+address1+"&address2="+address2+"&suburb="+suburb+"&state="+state+"&postcode="+postcode+"&mobile="+mobile+"",null,"width=800,height=400,left=100,top=100");
}
</script>
You are not passing a value for parameter val to your Javascript function.
onClick="Address('<?php echo $order->firstname ?>'
should be something like:
onClick="Address('theValue', '<?php echo $order->firstname ?>'
Related
This is my first time ever using isotope. So, I create the isotope instance inside of my document.ready function like so:
var grid = $('.headshots-list');
grid.isotope({
// options
itemSelector: '.headshots-list-item-alt',
layoutMode: 'fitRows',
sortBy: '[data-number]'
});
Then I set the values of each element in my grid layout including setting the data-number attribute.
$("#headshot_" + $(this).val()).attr('data-number', 2); // Users who are not chairpersons
$("#headshot_" + $(this).val()).attr('data-number', 1); // Users who are chairpersons
Then I try to sort the grid. Currently, I am using the setTimeout only because I was testing to see if maybe I had a race condition but it made no difference. The grid does not order itself in the way that I am expecting so that the user with data-number 1 will show before all other users. These attributes are being set. I have viewed the elements in dev tools to be sure.
As I mentioned earlier, this is the first time I have ever used isotope so not sure what I am doing wrong. Any pointers in the right direction will be greatly appreciated.
As requested below, this is the HTML where I build out the li that goes with this.
<li id="headshot_<?php echo $user->ID; ?>"
data-number = "1" class="headshots-list-item-alt js-headshot <?php echo $user_terms_classes . ' ' . $board_status . ' ' . $number; ?>"
data-toggle="modal"
data-target="#memberInfo_<?php echo $member_id; ?>">
<div class="headshot-list-item-inner">
<div class="headshot-list-photo">
<?php //suppress photo until they come in
?>
<?php if ($photo_id): ?>
<?php // echo wp_get_attachment_image( $photo_id, 'Avatar' ); ?>
<?php else: ?>
<?php // echo '<img src="https:somedomain.com/imgs/user_img.jpg"/>'; ?>
<?php endif; ?>
</div>
<h4 class="no-margin">
<?php echo $name; ?>
<input type="hidden" class="user_id" value="<?php echo $user->ID; ?>">
<span style="font-size:14px; display: block; position: relative; width: 100%;"
class="chair_designation" id="chair_designation_<?php echo $user->ID ?>">
</span>
</h4>
<p class="no-margin"><?php echo $title; ?></p>
<span class="headshot-list-item-tag">View Bio</span>
</div>
</li>
im triying to add dash in the phone numbers when added, the phone numbers are added complete without spaces. like: 1234567890, and i want the output to be:
123-456-7890
Depending on where the number is from it will change, for ex.:
Italy is: +391234567890 (+39-123-456-7890)
Spain is: +34123456789 (+34-123-45-67-89)
and so on.
this is the code im triying to add it to:
<div class="btn-group btn-group-sm" role="group" aria-label="Extra-small button group">
<a class="client_copy btn btn-gold"
data-client-name="<?php echo $emp['client_name']; ?>"
data-Client-email="<?php echo $emp['id_clients']; ?>"
data-client-phone="<?php echo $emp['phone_no']; ?>"
data-client-id="<?php echo $emp['ID']; ?>"
data-client-group="<?php echo $emp['group_name']; ?>"
data-client-city="<?php echo '$' . $emp['myprice']; ?>"
data-client-paymentmethod="<?php echo $emp['payment_method_name']; ?>"
data-client-paymentvia="<?php echo $emp['payment_via_name']; ?>"
data-client-paymentdetail="<?php echo $emp['payment_detail']; ?>"
data-client-paymentdate="<?php echo $emp['payment_date']; ?>"
data-client-customprice="<?php echo $emp['custom_price']; ?>"
href="#modalCopyClient"><i class="fa fa-files-o"></i></a>
So, the phone part is:
data-client-phone="<?php echo $emp['phone_no']; ?>"
i tried a couple solutions posted here but i coulndt make it work
one of them was to add:
echo '('.substr($data, 0, 3).') '.substr($data, 3, 3).'-'.substr($data,6);
that may be the solution but it didnt work for me, i ended having an error
i add it this way:
data-client-phone="<?php echo '('.substr($data, 0, 3).') '.substr($data, 3, 3).'-'.substr($data,6); $emp['phone_no']; ?>"
and had this error:
Error
i know the error might be obvious but i just dont know that much about coding. sorry.
thanks!
I am working php application with code igniter framework and have attached fancybox js with the application.
this is my view file.
<?php foreach ($item['items'] as $key => $value): ?>
<li>
<a style="text-decoration:none;"
data-fancybox="<?php echo $value['group']; ?>"
href="<?php echo base_url(); ?>assets/img/products/<?php echo #$value['images'][0]; ?>">
<?php echo $value['name']; ?>
</a>
</li>
<!-- <div> -->
<?php unset($value['images'][0]); ?>
<?php if (empty(!$value['images'])) :?>
<?php foreach ($value['images'] as $img): ?>
<a data-fancybox="printer" href="<?php echo base_url(); ?>assets/img/products/<?php echo $img; ?>"></a>
<?php endforeach ?>
<?php endif; ?>
<!-- </div> -->
<?php endforeach; ?>
I need view
href="<?php echo base_url(); ?>assets/img/products/<?php echo $img; ?>"
in fancybox view but when I click slider items it is only view one image and not display movement arrow. my url display like this
http://localhost/technet/products#printers
how can I fix this problem?
It is not possible to help you without seeing your live page or at least seeing what html code you have. Because, how can we know what your php code produces?
I can only guess that <?php echo $value['group']; ?> outputs something different for each link and therefore grouping is not working.
I've been able to get my arrays working to echo text from a database in HTML. Fine. However, I now want to send this text to another page onClick (JQuery or JavaScript). So here is what I already have (I know it's not sending anything, but this is not the problem right now) :
PHP
$h = "SELECT * FROM table";
$h=$pdo->prepare($h);
$h->execute();
$i=1;
while ($row = $h->fetch()) {
$text[$i] = $row['content'];
$id[$i] = $row['id'];
$i++;
}
HTML
<h1 id="<?php echo $id[0]; ?>" onClick="edit(this)"><?php echo $text[0]; ?>
</h1>
<h2 id="<?php echo $id[1]; ?>" onClick="edit(this)"><?php echo $text[1]; ?></h2>
<p id="<?php echo $id[2]; ?>" onClick="edit(this)"><?php echo $text[2]; ?></p>
JavaScript
function edit(element) {
alert(element.id);
}
So, this gives me the "id" of the content in the database. However, I'd like to know if there is a way to get this information without having the "id" in the HTML tags, a way to click on the text and have the number that is inside the square brackets.
Example : you click on the text inside the "h1" tag and a pop up tells you what is the number in <?php echo $text[2]; ?>. In this case, I would like the number 2 to show up in the alert box, without using id="<?php echo $id[2]; ?>".
I have this javascript function that puts a double --- quote ---- which people can use on the site. My goal is to replace the ---quote--- with a image or a blockquote (styled with CSS) that I already have. So if someone clicks on the button, they have to get a quote image or blockquote, which would be visible on the textarea. The problem is that I can't get it working.
<input type="button" onclick="hen('d','--- (<? echo $language[quote2] ?>: <? echo $language[quote] ?>) ---\n\r','\n\r--- (<? echo $language[quote2] ?>: <? echo $language[quote] ?>) ---\r')" value="- <? echo $language[quote] ?> -" />
This is what I tried for example, which did not show the button anymore.
<input type="button" onclick="hen('d','--- (<blockquote id="entry"><? echo $language[quote2] ?>: <? echo $language[quote] ?></blockquote) ---\n\r','\n\r--- (<? echo $language[quote2] ?>: <? echo $language[quote] ?>) ---\r')" value="- <? echo $language[quote] ?> -" />
How can I make it work my friends?
Well, I can tell you why the button is disappearing at least. You're breaking out of the onclick attribute by listing the blockquote id within double quotes. Try this and see where it gets you:
<input type="button" onclick="hen('d','--- (<blockquote id=\'entry\'><? echo $language[quote2] ?>: <? echo $language[quote] ?></blockquote) ---\n\r','\n\r--- (<? echo $language[quote2] ?>: <? echo $language[quote] ?>) ---\r')" value="- <? echo $language[quote] ?> -" />
Although if you're trying to insert HTML elements into a Textarea, I do not believe that is possible. You may want to try using a <div contenteditable="true"></div> instead (of course, that will only work in browsers that support the contenteditable attribute.