Welcome Guest, Not a member yet? Register   Sign In
How to change the text on a button progamatically?
#18

I'm not familiar with CodeIgniter Simplicity, so I'm not sure where it's going wrong.
If you choose to store the active campaign in a session variable, you can stick with the old code you had, and set the text of the red button accordingly.

PHP Code:
<button id="myCamp" class="btn pull-right btn-danger navbar-btn">Active Campaign: <?= $this->session->campaign;?></button> 

If you don't want to use a button, you should use css to style the element. One way is by using class names (like Bootstrap is doing for a lot of elements). Another way is setting the style attribute of the element.

Example:
PHP Code:
<div style="background-color: black; color: white; padding: 12px; font-size: 20pt; font-weight: bolder;">
<?= 
$this->session->campaign;?>
</div> 

A good tutorial about css: https://www.w3schools.com/css/
Reply


Messages In This Thread
RE: How to change the text on a button progamatically? - by Wouter60 - 01-13-2018, 09:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB