Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

sash_oo7

Privileged
  • Joined

  • Last visited

Everything posted by sash_oo7

  1. hello friends, I was following a youtube video on making a s tudent management system with codeigniter3 but i am stuck at some point when i click on edit on view students page..its showing me the details of same student whatever student i choose here is the code for view viewStudents.php <?php include('inc/header.php');?> <div class="container mt-2"> <h2>Students</h2> <hr> <?php echo anchor('admin/dashboard','BACK',['class'=>'btn btn-warning']);?> <div class="table-responsive"> <table class="table table-hover"> <thead> <tr> <th scope="col">Student Name</th> <th scope="col">College Name</th> <th scope="col">Course</th> <th scope="col">Email</th> <th scope="col">Gender</th> <th scope="col">Action</th> </tr> </thead> <tbody> <?php if(count($students)){ ?> <?php foreach ($students as $student){?> <tr> <td><?php echo $student->studentname; ?></td> <td><?php echo $student->collegename; ?></td> <td><?php echo $student->course; ?></td> <td><?php echo $student->email; ?></td> <td><?php echo $student->gender; ?></td> <td> <?php echo anchor("admin/editStudent/{$student->id}","Edit",['class'=>'btn btn-light']);?> <?php echo anchor("admin/deleteStudent/{$student->id}","Delete",['class'=>'btn btn-danger']);?> </td> </tr> <?php } ?> <?php } else {?> <tr> <td>No Record found</td> </tr> <?php } ?> </tbody> </table> </div> </div> <?php include('inc/footer.php');?> editstudent.php (view) <?php include('inc/header.php');?> <div class="container mt-2"> <?php echo form_open('admin/createStudent',['class'=>'form-hoizontal']);?> <h3 class="text-center display-4">EDIT STUDENT</h3> <hr/> <?php if($msg = $this->session->flashdata('message')){ ?> <div class="row"> <div class="col-md-6"> <div class="alert alert-dismissible fade show alert-success"> <button type="button" class="close" data-dismiss="alert">&times;</button> <?php echo $msg;?> </div> </div> </div> <?php } ?> <div class="row"> <div class="col-md-6"> <div class="form-group"> <div class="row"> <div class="col-md-3"> <label for="studentname" class="mt-2">Student name:</label> </div> <div class="col-md-9"> <!-- <input type="text" class="form-control" placeholder="User name" id="username"> --> <?php $data = array( 'type' => 'text', 'name' => 'studentname', 'value' => set_value('studentname',$studentData->studentname), 'placeholder' => 'Enter Studentname', 'class' => 'form-control' ); echo form_input($data); ?> </div> </div> </div> </div> <div class="col-md-6"> <?php echo form_error('studentname','<div class="text-danger mt-2">','</div>');?> </div> </div><!--row--> <div class="row"> <div class="col-md-6"> <div class="form-group"> <div class="row mt-3"> <div class="col-md-3"> <label for="email" class="mt-2">College Name:</label> </div> <div class="col-md-9"> <select class="form-control" name="college_id"> <option value="<?php echo $studentData->college_id; ?>"><?php echo $studentData->collegename; ?></option> <?php if(count($colleges)) { ?> <?php foreach ($colleges as $college){?> <option value="<?php echo $college->college_id;?>"><?php echo $college->collegename;?></option> <?php } } ?> </select> </div> </div> </div> </div> <div class="col-md-6"> <?php echo form_error('college_id','<div class="text-danger mt-4">','</div>');?> </div> </div><!--row--> <div class="row"> <div class="col-md-6"> <div class="form-group"> <div class="row mt-3"> <div class="col-md-3"> <label for="email" class="mt-2">Email address:</label> </div> <div class="col-md-9"> <!-- <input type="email" class="form-control" placeholder="Enter email" id="email"> --> <?php $data = array( 'type' => 'email', 'name' => 'email', 'value' => set_value('email'), 'placeholder' => 'Enter Email', 'class' => 'form-control' ); echo form_input($data); ?> </div> </div> </div> </div> <div class="col-md-6"> <?php echo form_error('email','<div class="text-danger mt-4">','</div>');?> </div> </div><!--row--> <div class="row"> <div class="col-md-6"> <div class="form-group"> <div class="row mt-3"> <div class="col-md-3"> <label for="gender" class="mt-2">Gender:</label> </div> <div class="col-md-9"> <!-- <input type="email" class="form-control" placeholder="Enter email" id="email"> --> <select class="form-control" name="gender"> <option value="">Select</option> <option value="Male">Male</option> <option value="Female">Female</option> </select> </div> </div> </div> </div> <div class="col-md-6"> <?php echo form_error('gender','<div class="text-danger mt-4">','</div>');?> </div> </div><!--row--> <div class="row"> <div class="col-md-6"> <div class="form-group"> <div class="row"> <div class="col-md-3"> <label for="course" class="mt-2">Course:</label> </div> <div class="col-md-9"> <!-- <input type="text" class="form-control" placeholder="User name" id="username"> --> <?php $data = array( 'type' => 'text', 'name' => 'course', 'value' => set_value('course'), 'placeholder' => 'Enter Course', 'class' => 'form-control' ); echo form_input($data); ?> </div> </div> </div> </div> <div class="col-md-6"> <?php echo form_error('course','<div class="text-danger mt-2">','</div>');?> </div> </div><!--row--> <div class="row"> <div class="col-md-6"> <!-- <button type="submit" class="btn btn-dark float-right">Register</button> --> <div class="float-right"> <button type="submit" class="btn btn-dark">ADD STUDENT</button> <?php //echo form_submit('Register', 'Register',"class='btn btn-dark'"); ?> <?php echo anchor('welcome','GO BACK',['class'=>'btn btn-warning']);?> </div> </div> </div> <?php echo form_close(); ?> </div> <?php include('inc/footer.php');?> i have joined college table and students table and getting the id of student model queries.php <?php class Queries extends CI_model { public function getRoles() { $roles = $this->db->get('tbl_roles'); if($roles->num_rows() > 0){ return $roles->result(); } } public function getColleges() { $colleges = $this->db->get('tbl_college'); if($colleges->num_rows() > 0){ return $colleges->result(); } } public function registerAdmin($data) { return $this->db->insert('tbl_users',$data); } public function chkAdminExist() { $chkAdmin = $this->db->where(['role_id' => '1']) ->get('tbl_users'); if($chkAdmin->num_rows() > 0){ return $chkAdmin->num_rows(); } } public function adminExist($email,$password) { $chkAdmin = $this->db->where(['email' => $email, 'password' => $password]) ->get('tbl_users'); if( $chkAdmin->num_rows() > 0 ){ return $chkAdmin->row(); } } public function makeCollege($data) { return $this->db->insert('tbl_college',$data); } public function registerCoAdmin($data) { return $this->db->insert('tbl_users',$data); } public function viewAllColleges() { $this->db->select(['tbl_users.user_id','tbl_users.email','tbl_college.college_id','tbl_users.username','tbl_users.gender','tbl_college.collegename','tbl_college.branch','tbl_roles.rolename']); $this->db->from('tbl_college'); $this->db->join('tbl_users', 'tbl_users.college_id = tbl_college.college_id'); $this->db->join('tbl_roles', 'tbl_roles.role_id = tbl_users.role_id'); $users = $this->db->get(); return $users->result(); } public function insertStudent($data) { return $this->db->insert('tbl_students',$data); } public function getStudents($college_id) { $this->db->select(['tbl_students.id','tbl_college.collegename','tbl_students.studentname','tbl_students.email','tbl_students.gender','tbl_students.course']); $this->db->from('tbl_students'); $this->db->join('tbl_college', 'tbl_college.college_id = tbl_students.college_id'); $this->db->where(['tbl_students.college_id' => $college_id]); $students = $this->db->get(); return $students->result(); } //public function getStudentRecord($id) public function getStudentRecord($id) { /* $this->db->select(['tbl_college.college_id','tbl_college.collegename','tbl_students.id','tbl_students.email','tbl_students.gender','tbl_students.studentname','tbl_students.course']); $this->db->from('tbl_students'); $this->db->join('tbl_college', 'tbl_college.college_id = tbl_students.college_id'); */ //$this->db->where(['tbl_students.college_id' => $id]); // $student = $this->db->get(); // return $student->result(); /* $this->db->select(['tbl_college.college_id','tbl_college.collegename','tbl_students.id','tbl_students.email','tbl_students.gender','tbl_students.studentname','tbl_students.course']); */ $this->db->select(['tbl_college.college_id','tbl_college.collegename','tbl_students.id','tbl_students.email','tbl_students.gender','tbl_students.studentname','tbl_students.course']); $this->db->from('tbl_students'); $this->db->join('tbl_college', 'tbl_college.college_id = tbl_students.college_id'); $students = $this->db->get(); return $students->row(); } } ?> here is the code for controller admin.php <?php defined('BASEPATH') OR exit('No direct script access allowed'); // class Welcome extends CI_Controller { class admin extends My_Controller { public function dashboard() { //echo 'dashboard'; /* if(!$this->session->userdata('user_id')){ return redirect('welcome/login'); } */ $this->load->model('queries'); $users = $this->queries->viewAllColleges(); /* echo '<pre>'; print_r($users); echo '</pre>'; exit(); */ $this->load->view('dashboard',['users'=>$users]); } public function addCollege() { //echo 'addcollege'; $this->load->view('addCollege'); } public function addCoadmin() { //echo 'addCoadmin'; $this->load->model('queries'); $roles = $this->queries->getRoles(); $colleges = $this->queries->getColleges(); // print_r($roles); // exit(); $this->load->view('addCoadmin',['roles'=>$roles,'colleges'=>$colleges]); //$this->load->view('addCoadmin'); } public function addStudent() { //echo 'addStudent'; $this->load->model('queries'); $colleges = $this->queries->getColleges(); $this->load->view('addStudent',['colleges'=>$colleges]); //$this->load->view('addStudent'); } public function createCollege() { //echo 'create college'; $this->form_validation->set_rules('collegename','College Name','required'); $this->form_validation->set_rules('branch','Branch','required'); $this->form_validation->set_error_delimiters('<div class="text-danger">','</div>'); if($this->form_validation->run()){ echo 'validation passed'; $data = $this->input->post(); /* $collegename = $this->input->post('collegename'); $branch = $this->input->post('branch');*/ $this->load->model('queries'); //$collegeExist = $this->queries->collegeExist($collgename,$branch); if($this->queries->makeCollege($data)){ $this->session->set_flashdata('message','College Created Successfully'); }else{ $this->session->set_flashdata('message','Failed to Create College '); } return redirect('admin/addCollege'); }else{ //echo validation_errors(); $this->addCollege(); } } public function createCoadmin() { //echo 'create coadmin'; $this->form_validation->set_rules('username','Username','required'); $this->form_validation->set_rules('college_id','College','required'); $this->form_validation->set_rules('email','Email','required'); $this->form_validation->set_rules('gender','Gender','required'); $this->form_validation->set_rules('role_id','Role','required'); $this->form_validation->set_rules('password','Password','required'); $this->form_validation->set_rules('confpwd','Password Again','required|matches[password]'); $this->form_validation->set_error_delimiters('<div class="text-danger">','</div>'); if($this->form_validation->run()){ //echo 'validation passed'; $data = $this->input->post(); $data['password'] =sha1($this->input->post('password')); $data['confpwd'] =sha1($this->input->post('confpwd')); /* echo '<pre>'; print_r($data); echo '</pre>'; exit(); */ $this->load->model('queries'); if($this->queries->registerCoAdmin($data)){ $this->session->set_flashdata('message','Co Admin Registered Successfully'); }else{ $this->session->set_flashdata('message','Failed to Register Co Admin '); } return redirect('admin/addCoadmin'); }else{ //echo 'validation error'; //echo validation_errors(); $this->addCoadmin(); } } public function createStudent() { //echo 'create coadmin'; $this->form_validation->set_rules('studentname','Studentname','required'); $this->form_validation->set_rules('college_id','College Name','required'); $this->form_validation->set_rules('email','Email','required'); $this->form_validation->set_rules('gender','Gender','required'); $this->form_validation->set_rules('course','Course','required'); $this->form_validation->set_error_delimiters('<div class="text-danger">','</div>'); if($this->form_validation->run()){ echo 'validation passed'; $data = $this->input->post(); /*$data['password'] =sha1($this->input->post('password')); $data['confpwd'] =sha1($this->input->post('confpwd')); */ /* echo '<pre>'; print_r($data); echo '</pre>'; exit(); */ $this->load->model('queries'); if($this->queries->insertStudent($data)){ $this->session->set_flashdata('message','Student Added Successfully'); }else{ $this->session->set_flashdata('message','Failed to Add Student '); } return redirect('admin/addStudent'); }else{ //echo 'validation error'; //echo validation_errors(); $this->addStudent(); } } public function viewStudents($college_id) { //echo 'view college'; //echo $college_id; $this->load->model('queries'); $students = $this->queries->getStudents($college_id); $this->load->view('viewStudents',['students'=>$students]); } public function editStudent($id) { $this->load->model('queries'); $studentData = $this->queries->getStudentRecord($id); /* echo '<pre>'; print_r($studentData); echo '</pre>'; exit(); */ $this->load->view('editStudent',['studentData'=>$studentData]); // $this->load->view('editStudent'); //echo 'editStudent'; echo $id; } public function __construct() { parent::__construct(); if(!$this->session->userdata('user_id')){ return redirect('welcome/login'); } } } here is the screenshot of what i see ..when i click edit for different students i have echoed the id of 2 students you can clearly see at the top left but their details ae showing same on the edit page any help will be appreciated..thanks i was missing the where clause in queries.php in getStudentRecord function here is the updated code queries.php <?php class Queries extends CI_model { public function getRoles() { $roles = $this->db->get('tbl_roles'); if($roles->num_rows() > 0){ return $roles->result(); } } public function getColleges() { $colleges = $this->db->get('tbl_college'); if($colleges->num_rows() > 0){ return $colleges->result(); } } public function registerAdmin($data) { return $this->db->insert('tbl_users',$data); } public function chkAdminExist() { $chkAdmin = $this->db->where(['role_id' => '1']) ->get('tbl_users'); if($chkAdmin->num_rows() > 0){ return $chkAdmin->num_rows(); } } public function adminExist($email,$password) { $chkAdmin = $this->db->where(['email' => $email, 'password' => $password]) ->get('tbl_users'); if( $chkAdmin->num_rows() > 0 ){ return $chkAdmin->row(); } } public function makeCollege($data) { return $this->db->insert('tbl_college',$data); } public function registerCoAdmin($data) { return $this->db->insert('tbl_users',$data); } public function viewAllColleges() { $this->db->select(['tbl_users.user_id','tbl_users.email','tbl_college.college_id','tbl_users.username','tbl_users.gender','tbl_college.collegename','tbl_college.branch','tbl_roles.rolename']); $this->db->from('tbl_college'); $this->db->join('tbl_users', 'tbl_users.college_id = tbl_college.college_id'); $this->db->join('tbl_roles', 'tbl_roles.role_id = tbl_users.role_id'); $users = $this->db->get(); return $users->result(); } public function insertStudent($data) { return $this->db->insert('tbl_students',$data); } public function getStudents($college_id) { $this->db->select(['tbl_students.id','tbl_college.collegename','tbl_students.studentname','tbl_students.email','tbl_students.gender','tbl_students.course']); $this->db->from('tbl_students'); $this->db->join('tbl_college', 'tbl_college.college_id = tbl_students.college_id'); $this->db->where(['tbl_students.college_id' => $college_id]); $students = $this->db->get(); return $students->result(); } //public function getStudentRecord($id) public function getStudentRecord($id) { /* $this->db->select(['tbl_college.college_id','tbl_college.collegename','tbl_students.id','tbl_students.email','tbl_students.gender','tbl_students.studentname','tbl_students.course']); $this->db->from('tbl_students'); $this->db->join('tbl_college', 'tbl_college.college_id = tbl_students.college_id'); */ //$this->db->where(['tbl_students.college_id' => $id]); // $student = $this->db->get(); // return $student->result(); /* $this->db->select(['tbl_college.college_id','tbl_college.collegename','tbl_students.id','tbl_students.email','tbl_students.gender','tbl_students.studentname','tbl_students.course']); */ $this->db->select(['tbl_college.college_id','tbl_college.collegename','tbl_students.id','tbl_students.email','tbl_students.gender','tbl_students.studentname','tbl_students.course']); $this->db->from('tbl_students'); $this->db->join('tbl_college', 'tbl_college.college_id = tbl_students.college_id'); $this->db->where(['tbl_students.id' => $id]); $students = $this->db->get(); return $students->row(); } } ?>
  2. hello friends, Still new to node I was follwing a tutorial on how touse Joi9 validation with node express but i am getting this error here is my code app.js const express = require('express'); const path = require('path'); const Joi = require('joi'); const bodyParser = require('body-parser'); const app = express(); //const hostname = '127.0.0.1'; app.use('/public',express.static(path.join(__dirname,'static'))); app.use(bodyParser.urlencoded({extended:false})); app.use(bodyParser.json()); //const port = 3000; app.get('/',(req,res)=>{ res.sendFile(path.join(__dirname,'static','index.html')); }); app.post('/',(req,res)=>{ console.log(req.body); const schema = Joi.object().keys({ email: Joi.string().trim().email().required(), password: Joi.string().min(5).max(10).required() }); Joi.validate(req.body,schema,(err,result)=>{ if(err){ console.log(err); res.send('an error occured'); } console.log(result); res.send('succesfully posted data'); }) }); app.listen(3000); and index.html inside static folder <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Html</title> <style> /* Forms */ [type=text], [type=email], [type=url], [type=password], select, textarea { display: block; padding: .5rem; background: transparent; vertical-align: middle; width: 100%; max-width: 100%; border: 1px solid #cdcdcd; border-radius: 4px; font-size: .95rem; } [type=text]:focus, [type=email]:focus, [type=url]:focus, [type=password]:focus, select:focus, textarea:focus { outline: none; border: 1px solid #1E6BD6; } select { -webkit-appearance: none; -moz-appearance: none; background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAJCAYAAAA/33wPAAAAvklEQVQoFY2QMQqEMBBFv7ERa/EMXkGw11K8QbDXzuN4BHv7QO6ifUgj7v4UAdlVM8Uwf+b9YZJISnlqrfEUZVlinucnBGKaJgghbiHOyLyFKIoCbdvecpyReYvo/Ma2bajrGtbaC58kCdZ1RZ7nl/4/4d5EsO/7nzl7IUtodBexMMagaRrs+06JLMvcNWmaOv2W/C/TMAyD58dxROgSmvxFFMdxoOs6lliWBXEcuzokXRbRoJRyvqqqQvye+QDMDz1D6yuj9wAAAABJRU5ErkJggg==) 100% no-repeat; line-height: 1 } label { font-weight: 600; font-size: .9rem; display: block; margin: .5rem 0; } /* Other */ * { box-sizing: border-box; } html { -webkit-font-smoothing: antialiased; padding: 1rem; } .container { max-width: 600px; margin: 0 auto; padding: 0 1rem; } /* Button */ [type=submit] { display: inline-block; vertical-align: middle; white-space: nowrap; cursor: pointer; margin: .25rem 0; padding: .5rem 1rem; border: 1px solid #1E6BD6; border-radius: 18px; background: #1E6BD6; color: white; font-weight: 600; text-decoration: none; font-family: sans-serif; font-size: .95rem; margin-top:1rem; } </style> </head> <body> <div class="container"> <form action="/" method="POST" id="form"> <label for="email">Email</label> <input type="email" id="email" placeholder="Email Address"> <label for="password">Password</label> <input type="password" id="password" placeholder="Password"> <input type="submit" value="Submit"> </form> </div> <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script> <script> </script> </body> </html>
  3. hello friends, I was trying to show a message using node server but when i typed localhost:3000 in my browser it shows nothing here is my code const http = require('http'); const server = http.createServer((req,res)=>{ res.write('hello world from node js'); res.end(); }); server.listen('3000');
  4. <!DOCTYPE html> <html> <head> <style> .message_wrapper { display:flex; background-color:dodgerblue; flex:100%; flex-direction:column; } .message_wrapper_inner { flex:100%; display:flex; } .message_img_container { flex:10%; display:flex; align-self:flex-start; justify-content:center; padding:8px; } .message_img{ width:50px; height:50px; border-radius:50%; background-color:orange; } .message_container { flex:90%;; background-color:grey; padding:8px; } </style> </head> <body> <div class="message_wrapper"> <div class="message_wrapper_inner"> <div class="message_container"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus et velit tempor, vulputate turpis id, condimentum libero. Vivamus sed consectetur eros. Nunc sed posuere eros, ut vulputate dolor. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec ut nunc semper, lacinia dolor eu, hendrerit ex.</p> </div> <div class="message_img_container"> <div class="message_img"></div> </div> </div> <div class="message_wrapper_inner"> <div class="message_img_container"> <div class="message_img"></div> </div> <div class="message_container"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus et velit tempor, vulputate turpis id, condimentum libero. Vivamus sed consectetur eros. Nunc sed posuere eros, ut vulputate dolor. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec ut nunc semper, lacinia dolor eu, hendrerit ex.</p> </div> </div> </div> </body> </html> see live https://codepen.io/sash_007/pen/yLVyYpQ
  5. Hello friends I want to know can i install react running thsi command on G drive instead of C for insttaling react in default C: is this as said here https://www.w3schools.com/react/default.asp C:\Users\Your Name>npm install -g create-react-app but what if i do like this G:\react>npm install -g create-react-app and then create react application there G:\react>npx create-react-app myfirstreact the reason i am asking this becoz in future if i want to set up reactapplication in another drive say F: can i do that without any issue? or first times i always need to install on C drive first? after that i can access globally?
  6. you can try running your website in sucuri to check for malwares https://sitecheck.sucuri.net also try using any cdn ..freeone is cloudflare
  7. Are you using wp custom post? Could be Flush WordPress Permalinks issue!! ok try this Step 1: In the WordPress admin area, go to “Settings > Permalinks” Step 2: Click “Save Changes” Step 3: Permalinks and rewrite rules are flushed.
  8. w3c css validator https://jigsaw.w3.org/css-validator/ you can paste your css directly or can paste css link there and fix the errors one by one that show up there
  9. i can see in your file path for scss file you named styles.scss and for css file you named style.css ? make both names similar and try to compile again like below --sass watch assets/scss/styles.scss assets/css/styles.css.
  10. the *{} selects all elements and all it's children elements where html{} only selects the <html> element see example <!DOCTYPE html> <html> <head> <style> html { border: solid 2px orange; } * { border: solid 2px green; font-size: 1.2em; } </style> </head> <body> <ul> <li>one</li> <li>two</li> <li>three <ul> <li>one</li> <li>two</li> <li>three</li> </ul> </li> </ul> <p>lorem ipsum</p> </body> </html>
  11. Hello friends, I am trying to make a button color switcher but somehow its not working although i see no error in the console here is the code <!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.4.1/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script> </head> <body> <div class ="container text-center"> <h2 id="changeMyColor">Challenge4: Change Color of buttons</h2> <br><br><br> <div class="row" style="border:1px solid black;padding:10px;min-height:80px;" id =""> <div class="col-md-2 col-xs-12"> <form> <div class="form-group"> <select class="form-control" name="backdrop" id="background" onchange="colorChange(this)"> <option>Random</option> <option>Red</option> <option>Green</option> <option>Reset</option> </select> </div> </form> </div> <div class="col-md-10 col-xs-12"> <div class="row"> <div class="col-md-3"> <button class="btn btn-info">Whoa!</button> </div> <div class="col-md-3"> <button class ="btn btn-danger">Yahoo!</button> </div> <div class="col-md-3"> <button class="btn btn-warning">Google!</button> </div> <div class="col-md-3"> <button class="btn btn-success">Facebook!</button> </div> </div> </div> </div> </div><!--container end--> </body> </html> and here is the javascript main.js //Challenge 4 color change let all_buttons = document.getElementsByTagName('button'); // console.log(all_buttons); //my_buttons = Array.from(all_buttons); // console.log(my_buttons); let copyAllButtons = []; for(let i = 0;i< all_buttons.length;i++){ copyAllButtons.push(all_buttons[i].classList[1]); } function colorChange(buttonThingy){ console.log(buttonThingy.value); if(buttonThingy.value === 'red'){ buttonsRed(); }else if(buttonThingy.value === 'green'){ //buttonsGreen(); }else if(buttonThingy.value === 'random'){ //buttonsRandom(); }else if(buttonThingy.value === 'reset'){ //buttonsReset(); } } function buttonsRed(){ /* copyAllButtons.forEach(function(button){ button.classList.remove(all_buttons[i].classList[1]); button.classList.add('btn-danger'); }); */ for(let i = 0; i<all_buttons.length;i++) { all_buttons[i].classList.remove(all_buttons[i].classList[1]); all_buttons[i].classList.add('btn-danger'); } } console.log(copyAllButtons); All i want to do is replace the second btn class in each button and replace with btn-danger but somehow its not working
  12. thanks everyone i seem to have fixed it used button submit instead of input type submit here is the cf7 admin code <div class="row"> <div class="col-md-6"> <label> [text* your-name placeholder "Name"] </label> </div> <div class="col-md-6"> <label> [email* your-email placeholder "Email"] </label> </div> <div class="col-md-12"> <label> [text your-subject placeholder "Subject" ] </label> </div> <div class="col-md-12"> <label> [textarea your-message placeholder "Message"] </label> </div> </div> <h6 class="center-text mtb-30"><button type="submit" class="btn-primaryc plr-25"><b>SEND MESSAGE</b></button></h6>
  13. Hello friends, I have been trying to styling the contact form 7 here https://webdesigncut.com/wordpress/luigis/contact/ so far everything works apart from the submit button styling hee is the css i added .wpcf7-form-control-wrap { position: relative; display:block; } .wpcf7 input[type=submit] { position: relative; text-align: center; height: 55px; line-height: 50px; background: #EF0031; color: #fff; border-radius: 3px; z-index: 1; } .wpcf7 input[type=submit]:after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: #1F8330; z-index: -2; -webkit-transition: all .1s ease-in; transition: all .1s .1s ease-in; } .wpcf7 input[type=submit]:before { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: #1F8330; z-index: -2; -webkit-transition: all .1s ease-in; transition: all .1s .1s ease-in; } .wpcf7 input[type=submit]:hover { color:#111; } .wpcf7 input[type=submit]:hover:after { height:100%; } .wpcf7 input[type=submit]:hover:before { height:100%; border:1px solid #1F8330; }
  14. whichever element you want to center inside a container simply you need to make that container display flex and if you want to align any item center horizontally.. just need to say justify-content:center and if you need to center vertically align-items:center and if you need absolute center need to use both justify-content:center and align-items:center <div class="container"> <h1>Some text</h1> </div> <div class="container2"> <h1>Some text</h1> </div> <div class="container3"> <h1>Some text</h1> </div> .container{ height:500px; background:#efefef; display:flex; width:40%; margin:10px auto; justify-content:center; } .container2{ height:500px; background:#efefef; display:flex; width:40%; margin:10px auto; align-items:center; } .container3{ height:500px; background:#efefef; display:flex; width:40%; margin:10px auto; justify-content:center; align-items:center; }
  15. Hello friends, Any idea why the seach popup only works on small screen using vanilla js and why the jquery method does noy work at all I am trying to add a simple seach popup screen with classlist add and remove with vanilla js but it only works for small screen here is the code const openButton = document.querySelector(".js-search-trigger"); const closeButton = document.querySelector(".search-overlay__close"); const searchOverlay = document.querySelector(".search-overlay"); openButton.addEventListener("click",openOverlay); closeButton.addEventListener("click",closeOverlay); function openOverlay(){ searchOverlay.classList.add("search-overlay--active"); document.body.classList.add("body-no-scroll"); } function closeOverlay(){ searchOverlay.classList.remove("search-overlay--active"); } you can see it live here https://webdesigncut.com/new/university/ also wanna know why this jquery doesnt work at all class Search { //1.describe and create/initiate our object constructor(){ //alert('hello i am a search from module'); this.openButton = $(".js-search-trigger"); this.closeButton = $(".search-overlay__close"); this.searchOverlay = $(".search-overlay"); this.events(); } //2.events events(){ this.openButton.on("click",this.openOverlay.bind(this)); this.closeButton.on("click",this.closeOverlay.bind(this)); } //3.methods openOverlay(){ this.searchOverlay.addClass("search-overlay--active"); } closeOverlay(){ this.searchOverlay.removeClass("search-overlay--active"); } } //export default Search; var amazingSearch = new Search();
  16. are you using any plugin for your wordpress form? if using plugin have you checked the plugin admin features ?
  17. i installed sass running this code npm install -g sass which is there on https://sass-lang.com/install currently i have no issues compiling scss files which is directly under D directory sass --watch main.scss main.css or inside a folder say programming sass --watch programming/main.scss programming/main.css or inside another subfolder scss which is under sass folder inside programming sass --watch programming/sass/scss/main.scss programming/sass/css/main.css here you can see everytime i need to describe the path to both scss and css file for both input and output my query is.... Is there any global command that i can run on node js so that i can watch any scss or css files in any subdirectory inside the D;drive (where i installed sass in this case) p.s:i have created the extra sass folder just for my own reference
  18. hello friends, Currently i hav installed sass using node.js inside d: directory. And main is folder inside d: directory and with the command prompt of node i can watch my scss file for changes and write into css with this command sass --watch programming/sass/scss/main.scss programming/sass/css/main.css with this directory structure now is there any way i can watch changes under subdir2,subdir3,subdir4,subdir5 with a single command?
  19. i didnt update it on the server tested on local wamp server
  20. thanks..this did the trick .wpcf7-form-control-wrap { position: relative; display:block; } i tried that before but it was not updating since i didn't add microtime() function in place of version while enqueing style andclearing bowser cache was not having any effect <?php /*previously wp_enqueue_style( 'custom', get_template_directory_uri() . '/common/custom.css', array(),'1.0' ); */ wp_enqueue_style( 'custom', get_template_directory_uri() . '/common/custom.css', array(), microtime() ); ?>
  21. Hello sorry for late reply . .but display block didnt solve the issue see the page here https://webdesigncut.com/wordpress/luigis/sample-page/
  22. hello friends, I have been trying to make wordpress contact form7 plugin textarea 100% width but it never worked same thing happens with input fields also the 100% doesnt work on them too although all other styles i applied worked here is the css /* Submit Button CF7 CSS Styles */ .wpcf7 input[type=submit] { padding:15px 45px; background:#FF0000; color:#fff; font-size:30px; font-weight:bold; border:0 none; cursor:pointer; -webkit-border-radius: 5px; border-radius: 5px; } /* File Upload Button CF7 CSS Styles */ .wpcf7 input[type=file] { padding:15px 25px; background:#abffa9; color:#000; font-size:14px; border:1px solid #79c777; -webkit-border-radius: 2px; border-radius: 2px; } /* Label Text Contact Form 7 CSS Styles */ .wpcf7 label { padding: 0 0 10px 0; font-size: 20px; /* color:green; background-color:yellow; */ } /* Text Input Field Contact Form 7 Styles */ .wpcf7 input[type=text], .wpcf7 input[type=email], .wpcf7 input[type=url], .wpcf7 input[type=tel], .wpcf7 input[type=number], .wpcf7 .wpcf7-select { font-size:20px; border: 1px solid red; padding:8px; } /* Textarea Field CF7 CSS Styles */ .wpcf7 textarea { width: 100% !important; color: red; font-size: 20px; border-color:red; padding:8px; background:#efefef; } only thing that worked is adjusting the columns in create contact form field where i added 80 columns <label> Your Name (required) [text* your-name] </label> <label> Your Email (required) [email* your-email] </label> <label> Your Tel [tel tel-706] </label> <label> Your Date [date date-928] </label> <label> How You Found us? [select menu-658 include_blank "friends" "email" "google"] </label> <label> Upload File [file file-570 limit:1mb filetypes:.jpg.jpeg] </label> <label> Subject [text your-subject] </label> <label> Your Message [textarea your-message 80x] </label> [submit "Send Message"]
  23. hello friends i am trying to insert data using mysqli prepeared statement this code works without using prepared <!DOCTYPE html> <html lang = "en"> <head> <title>Forms</title> <meta charset = "utf-8"> <meta name = "viewport" content = "width=device-width , initial-scale =1"> <link rel="stylesheet" href="css/bootstrap.min.css"> <script src = "js/jquery-3.4.1.min.js"></script> <script src = "js/bootstrap.min.js"></script> <style> </style> </head> <body> <?php require("db.php"); //if form submitted ,insert values into the database if(isset($_POST["username"])){ //remove backslashes $username =stripslashes($_POST["username"]); //escapes speacial character in string $username = mysqli_real_escape_string($conn,$username); //remove backslashes $email =stripslashes($_POST["email"]); //escapes speacial character in string $email = mysqli_real_escape_string($conn,$email); //remove backslashes $password = stripslashes($_POST["password"]); //escapes speacial character in string $password = mysqli_real_escape_string($conn,$password); $password = md5($password); $trn_date =date("Y-m-d H:i:s"); $sql = "INSERT into `users_prepared` (username,password,email,trn_date) VALUES('$username' , '$password','$email','$trn_date')"; $result = mysqli_query($conn,$sql); if($result){ ?> <div class="container"> <div class="alert alert-success"> <strong>Success!</strong> You have regsitered succesfully. </div> <a href="login.php" class="btn btn-success" role="button">Click here to login</a> <form action="register.php" method ="post"> <h1>Registration</h1> <div class="form-group"> <label for ="usr">Name:</label> <input type="text" name="username" class="form-control" id="usr" placeholder="username" required> </div><!--form-group--> <div class="form-group"> <label for ="email">Email address</label> <input type="email" name="email" class="form-control" id="email" placeholder="email" required> </div><!--form-group--> <div class="form-group"> <label for ="pwd">Password</label> <input type="password" name="password" class="form-control" id="pwd" placeholder="password" required> </div><!--form-group--> <button type="submit" class="btn btn-success">Submit</button> </form> </div><!--container--> <?php } }else{ ?> <div class="container"> <form action="register.php" method ="post"> <h1>Registration</h1> <div class="form-group"> <label for ="usr">Name:</label> <input type="text" name="username" class="form-control" id="usr" placeholder="username" required> </div><!--form-group--> <div class="form-group"> <label for ="email">Email address</label> <input type="email" name="email" class="form-control" id="email" placeholder="email" required> </div><!--form-group--> <div class="form-group"> <label for ="pwd">Password</label> <input type="password" name="password" class="form-control" id="pwd" placeholder="password" required> </div><!--form-group--> <button type="submit" class="btn btn-success">Submit</button> </form> </div><!--container--> <?php } ?> </body> </html> but this code using perepared statement not working all i see is blank page on submit <!DOCTYPE html> <html lang = "en"> <head> <title>Forms</title> <meta charset = "utf-8"> <meta name = "viewport" content = "width=device-width , initial-scale =1"> <link rel="stylesheet" href="css/bootstrap.min.css"> <script src = "js/jquery-3.4.1.min.js"></script> <script src = "js/bootstrap.min.js"></script> <style> </style> </head> <body> <?php require("db.php"); //if form submitted ,insert values into the database if(isset($_POST["username"])){ //remove backslashes $username =stripslashes($_POST["username"]); //escapes speacial character in string $username = mysqli_real_escape_string($conn,$username); //remove backslashes $email =stripslashes($_POST["email"]); //escapes speacial character in string $email = mysqli_real_escape_string($conn,$email); //remove backslashes $password = stripslashes($_POST["password"]); //escapes speacial character in string $password = mysqli_real_escape_string($conn,$password); $password = md5($password); //$trn_date =date("Y-m-d H:i:s"); $sql = "INSERT into `users_prepared` (username,password,email) VALUES(?,?,?)"; //create prepared statement $stmt = mysqli_stmt_init($conn); //bind parameters to the placeholders mysqli_stmt_bind_param($stmt,"sss",$data); //run parameters inside database mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); //$result = mysqli_query($conn,$sql); if($result){ ?> <div class="container"> <div class="alert alert-success"> <strong>Success!</strong> You have regsitered succesfully. </div> <a href="login.php" class="btn btn-success" role="button">Click here to login</a> <form action="register2.php" method ="post"> <h1>Registration 2</h1> <div class="form-group"> <label for ="usr">Name:</label> <input type="text" name="username" class="form-control" id="usr" placeholder="username" required> </div><!--form-group--> <div class="form-group"> <label for ="email">Email address</label> <input type="email" name="email" class="form-control" id="email" placeholder="email" required> </div><!--form-group--> <div class="form-group"> <label for ="pwd">Password</label> <input type="password" name="password" class="form-control" id="pwd" placeholder="password" required> </div><!--form-group--> <button type="submit" class="btn btn-success">Submit</button> </form> </div><!--container--> <?php } }else{ ?> <div class="container"> <form action="register2.php" method ="post"> <h1>Registration 2</h1> <div class="form-group"> <label for ="usr">Name:</label> <input type="text" name="username" class="form-control" id="usr" placeholder="username" required> </div><!--form-group--> <div class="form-group"> <label for ="email">Email address</label> <input type="email" name="email" class="form-control" id="email" placeholder="email" required> </div><!--form-group--> <div class="form-group"> <label for ="pwd">Password</label> <input type="password" name="password" class="form-control" id="pwd" placeholder="password" required> </div><!--form-group--> <button type="submit" class="btn btn-success">Submit</button> </form> </div><!--container--> <?php } ?> </body> </html> the view results page using prepared works <!DOCTYPE html> <html lang = "en"> <head> <title>Forms</title> <meta charset = "utf-8"> <meta name = "viewport" content = "width=device-width , initial-scale =1"> <link rel="stylesheet" href="css/bootstrap.min.css"> <script src = "js/jquery-3.4.1.min.js"></script> <script src = "js/bootstrap.min.js"></script> <style> </style> </head> <body> <div class="container"> <?php require("db.php"); $data ="John"; //create template $sql = "SELECT * FROM $tbl_name WHERE username =?;"; //create prepared statement $stmt = mysqli_stmt_init($conn); //prepare the prepared statement if(!mysqli_stmt_prepare($stmt,$sql)){ echo "Sql statement failed"; }else{ //bind parameters to the placeholders mysqli_stmt_bind_param($stmt,"s",$data); //run parameters inside database mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); // $result = mysqli_query($conn,$sql); // $resultCheck = mysqli_num_rows($result); // if($resultCheck>0){ //ouput data for each row while($row=mysqli_fetch_assoc($result)){ ?> <table class="table table-striped"> <thead> <tr> <th>Name</th> <th>Email</th> </tr> </thead> <tbody> <tr> <td><?php echo $row["username"]?></td> <td><?php echo $row["email"]?></td> </tr> </tbody> </table> <?php }//while end }//else end // } ?> </div><!--container--> </body> </html> any help will be appreciated,thanks
  24. hey thanks the problem was with a plugin that i was trying to make

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.