Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Convert JSON TO JAVASCRIPT and add data to HTML OR php Variable

In this tutorial learn how to convert JSON data using json.parse method to javascript, and How to convert to JSON to JavaScript and store to html, and also let's discuss with with JavaScript variable to store to PHP variable.

STEP 1.  JSON DATA to store javascript variable

var txt = '{"name":"Jack", "age":30, "city":"London"}'

Google chart images store into the folder using PHP, jquery and HTML

How to convert google chart images from base64 to png images and store into the folder, Here let's go with an example 

Explanation 1. 

Here the chart_div to generated a chart with image using google chart javascript as mention under the index.php code.

color change on button Keyframe Event using css

Color change effect hover button using a keyframes colorchange css, Its multiple color we can use when hover a on button.


@keyframes colorchange {
    0% {
        background-color: #009ee3;
    }
    40% {
        background-color: #6bb8ab;
    }
    75% {
        background-color: #bfe6ad;
    }
    100% {
        background-color: #2a2970;
    }
}

Drag and drop with multiple file upload using php

Drag and drop with multiple file upload using php, javascript, html

<?php
if(isset($_POST['Submit'])){ //upload
   $uploads_dir = 'img';
  foreach ($_FILES["multifileselect"]["error"] as $key => $error) {
      if ($error == UPLOAD_ERR_OK) {
          $tmp_name = $_FILES["multifileselect"]["tmp_name"][$key];
         $name = basename($_FILES["multifileselect"]["name"][$key]);
          if (copy($tmp_name, "$uploads_dir/$name")){
               echo "successfully uploaded =>". $name;
          }else{
             echo "Not Uploaded Files";
          }

      }
  }
}?>

how to pass multiple value from html to javascript by id

In this tutorial learn how to pass multiple values from html to javascript using id with blur event.
Pass multiple value from html to javascript by id  with blur event, pass value from html to javascript  and get value in function with javascript  with display in a alert box.

Create a Html file and add input type then create a javascript function and create a two variable to get value by id


How to validate Email address in php in javascript?

In this tutorial learn how to validate email address in javascript, Validate Email address  in javascript, email validation using Example of valid email id

How to get a list of data in codeigniter using php

In this tutorial learn how to get a list of data in codeigniter using php, Its easy to get data list from view to controller,  Create a Signup.php in controller  keep first letter capital and create a file signup.php in view now  same get list for create a User.php in controller and user.php in view

Controller

application/controller/Signup.php


<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Signup extends CI_Controller {

public function index()
{

//controller part to get value and insert into the database

    $message="";
 
    if(isset($_POST['btnsignup'])){
        //value get
        $name=$this->input->post('name');
        $email=$this->input->post('email');
        $pass=$this->input->post('password');
        $address=$this->input->post('address');

  //here insert the data before we need to connect the data

  // now also load the database file
 $insdata=array('name'=>$name,'email'=>$email,'pass'=>$pass,'address'=>$address);    

        $this->db->insert('login',$insdata);

 $message="Thank You successfully registered";
   
      }

$data['message']=$message;

$this->load->view('pages/signup',$data);
 
}
}

application/view/pages/signup.php

<html>
<head>
<title>Sign up</title>
<style type="text/css">
input{
font-family: "Helvetica","Arial",sans-serif;
    margin: 0;
    padding: 4px 0;
    width: 207px;
    background: 0 0;
    text-align: left;
    }
#submit{
background-color: skyblue;
text-align: center;

}  

<?-- view signup data of form detail -->  
</style>
</head>
<body>
<div style="text-align:center;margin-top: 8%;">
<h1> Sign up</h1>
<div style="color:green">
<?php echo $message; ?>  <br/><br/>
</div>
<form action="" method="post">

<input type="text" name="name" value="name" /><br/><br/>
<input type="email" name="email" value="email" /><br/><br/>
<input type="password" name="password" value="password" /><br/><br/>
<input type="address" name="address" value="address" /><br/><br/>
<input type="submit" name="btnsignup" id="submit" value="submit" />
</form>
</div>
</body>
</html>


Controller

application/controller/User.php

User.php

<?php defined('BASEPATH') OR exit('No direct script access allowed');

class User extends CI_Controller {

public function index()
{

//pages to call

$this->load->view('pages/user');

   }
 
 }

 application/view/ user.php



<?php


$query = $this->db->query("SELECT * FROM login;"); ?>


<div style="text-align:center">
<h1>User List</h1>
<table style="text-align:center;margin-left: 38%;">
<thead>
<tr>
<th> name</th>
<th> Email</th>
<th> Password</th>
<th> Address</th>
</tr>
</thead>
<tbody>

<?php
foreach ($query->result('User') as $user)
{ ?>
<tr>
 <td>
    <?=$user->name;?>
 </td>
 <td>
    <?=$user->email;?>
 </td>
  <td>
    <?=$user->pass;?>
 </td>
  <td>
    <?=$user->address;?>
 </td>

</tr>            
 <?php        
}
?>

</tbody>
</table>
</div>





embed youtube video in html

We can embed YouTube videos to web site by using either the iframe or object HTML tags.

Based on the information from https://www.youtube.com/yt/dev/

Use the youtube site to find the video you want

Click the 'Share' button below the video

Click the 'Embed' button next to the link they show you
Copy the iframe code given and paste it into the html of your web page.

Example:

Porgramming Video
How to display records using database in php using codeigniter framework

https://www.youtube.com/watch?v=5TvbzlE2Xcw


<html>
 <body>
  <iframe src="https://www.youtube.com/watch?v=5TvbzlE2Xcw"
   width="460" height="415" frameborder="0" allowfullscreen></iframe>
 </body>
</html>


Example:

Same YouTube video using the object tag instead of the iframe tag

<html>
 <body>
  <object data="https://www.youtube.com/watch?v=5TvbzlE2Xcw"
   width="460" height="415"></object>
 </body>
</html>

How to generate form using form helper in php with codeigniter framework?

Generate form using form helper class in php with codeigniter  framework , to generate dynamic form. Loading this Helper

This helper is loaded using the following code (to controller class):

$this->load->helper('form');

 Here’s a simple example:

echo form_open('home');

The above example would create a form that points to your base URL plus the “email/send” URI
segments, like this:


<form method="post" accept-charset="utf-8" action="http://example.com/index.php/home">

How do check if an element is hidden in jQuery?

How do I check if an element is hidden in jQuery? It is possible to toggle the visibility of an element, using the functions .hide(), .show() or .toggle(). How would you test if an element is visible or hidden?



$(element).is(":visible");

// The same works with hidden
$(element).is(":hidden"); 


OR


You can use the hidden selector:

// Matches all elements that are hidden
$('element:hidden')
And the visible selector:

// Matches all elements that are visible
$('element:visible')

how to call ssh from vs code

 To call SSH from VS Code, you can use the built-in Remote Development extension. This extension allows you to open a remote folder or works...