I need to save my form without reloading the page, I have tried all the methods...but I'm beginner at Ajax and I can't figure it out how to do that.
Here is the most relevant link, but when I press submit button, doesn't working.
How to send data without refreshing page in laravel?
My view
<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog" role="document">
<div class="modal-content" style="top: 50px">
<div class="modal-header" style="border-bottom: none">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="container">
<div class="row">
<section>
<div class="wizard col-md-6" style="right: 5px;margin: 0px auto">
<div class="wizard-inner">
<div class="connecting-line"></div>
<ul class="nav nav-tabs" role="tablist" style="margin: 0px auto">
<li role="presentation" class="active">
<a href="#step1" data-toggle="tab" aria-controls="step1" role="tab" title="Step 1">
<span class="round-tab">
<i class="icon-pencil"></i>
</span>
</a>
</li>
<li role="presentation" class="disabled">
<a href="#step2" data-toggle="tab" aria-controls="step2" role="tab" title="Step 2">
<span class="round-tab">
<i class="icon-note"></i>
</span>
</a>
</li>
<li role="presentation" class="disabled">
<a href="#step3" data-toggle="tab" aria-controls="step3" role="tab" title="Step 3">
<span class="round-tab">
<i class="icon-check"></i>
</span>
</a>
</li>
</ul>
</div>
<form role="form" action="{{ action('CareerSolutionController#careerReport') }}" method="post">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<input type="hidden" name="user_id" value="{{ Sentinel::check()->id }}">
<input type="hidden" name="user_id_posted" value="{{ $career_solution->user->id }}">
<input type="hidden" name="career_solution_id" value="{{ $career_solution->id}} ">
<div class="tab-content">
<div class="tab-pane active" role="tabpanel" id="step1">
<h3>Why are you reporting this content :</h3>
<ul style="list-style: none">
<li>
<input type="radio" id="box-9" name="why_reporting" value="Spam">
<label for="box-9">Spam</label>
<div class="check"></div>
<small id="box-9-s" style="display: none">I consider this content irrelevant and annoying.</small>
</li>
<li>
<input type="radio" id="box-10" name="why_reporting" value="Fake Profile">
<label for="box-10">Fake Profile</label>
<div class="check"><div class="inside"></div></div>
<small id="box-10-s" style="display: none">This content was posted by way of a profile that clearly doesn't represent a real person.
</small>
</li>
<li>
<input type="radio" id="box-11" name="why_reporting" value="Advertising">
<label for="box-11">Advertising</label>
<div class="check"><div class="inside"></div></div>
<small id="box-11-s" style="display: none">This content is or contains advertising.
</small>
</li>
<li>
<input type="radio" id="box-12" name="why_reporting" value="Untrustworthy source">
<label for="box-12">Untrustworthy source</label>
<div class="check"><div class="inside"></div></div>
<small id="box-12-s" style="display: none">This content is from an untrustworthy source and contains unverifiable statements.
</small>
</li>
<li>
<input type="radio" id="box-13" name="why_reporting" value="Defamatory">
<label for="box-13">Defamatory</label>
<div class="check"><div class="inside"></div></div>
<small id="box-13-s" style="display: none">The reported content is insulting or defamatory to me or other people.
</small>
</li>
<li>
<input type="radio" id="box-14" name="why_reporting" value="Violence or pornography">
<label for="box-14">Violence or pornography</label>
<div class="check"><div class="inside"></div></div>
<small id="box-14-s" style="display: none">This content contains violence or pornography.
</small>
</li>
<li>
<input type="radio" id="box-15" name="why_reporting" value="Violates IP rights">
<label for="box-15">Violates IP rights</label>
<div class="check"><div class="inside"></div></div>
<small id="box-15-s" style="display: none">This content includes third-party content (e.g. an image) posted under their own name.
</small>
</li>
<li>
<input type="radio" id="box-16" name="why_reporting" value="Promotes structural distribution measures">
<label for="box-16">Promotes structural distribution measures</label>
<div class="check"><div class="inside"></div></div>
<small id="box-16-s" style="display: none">This content promotes a chain distribution system, multilevel selling or pyramid sales.
</small>
</li>
<li >
<input type="radio" id="box-17" name="why_reporting" value="Other">
<label for="box-17" id="other">Other</label>
<div class="check"><div class="inside"></div></div>
<div class="form-group" id="mydiv" style="display: none">
<textarea class="form-control" id="exampleFormControlTextarea1" rows="3" placeholder="Please let us know why you're reporting this content:
" style="resize: none" name="why_reporting_message"></textarea>
</div>
</li>
</ul>
<ul class="list-inline pull-right">
<li><button style="background-color: #18ba9b;border-color: white" type="button" class="btn btn-primary next-step">Save and continue</button></li>
</ul>
</div>
<div class="tab-pane" role="tabpanel" id="step2">
<h3>Why would you like to report this?</h3>
<div class="form-group">
<textarea class="form-control" id="exampleFormControlTextarea1" rows="5" style="resize: none" placeholder="
Please let us know why you're reporting this content:" name="additional_message"></textarea>
</div>
<ul class="list-inline pull-right">
<li><button type="button" class="btn btn-default prev-step">Previous</button></li>
<li><button type="button" class="btn btn-default next-step">Skip</button></li>
<li><button style="background-color: #18ba9b;border-color: white" type="button" class="btn btn-primary btn-info-full next-step" id="save">Submit your report</button></li>
</ul>
</div>
<div class="tab-pane" role="tabpanel" id="step3">
<h2 class="title-box-v2" style="font-size: 17px !important;line-height: 35px">We'll look into this as soon as possible. Thanks for helping us improve the quality of content on Workstickers.</h2>
<p style="text-align: center">You have successfully completed all steps.Flagged content and users are reviewed by Workstickers staff 24 hours a day, seven days a week to determine whether they violate Community Guidelines. Accounts are penalized for Community Guidelines violations, and serious or repeated violations can lead to account termination.
</p>
<div style="text-align: center;margin-top: 50px">If you've changed your mind - Cancel report</div>
</div>
<div class="clearfix"></div>
</div>
</form>
</div>
</section>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END MY MODAL -->
Ajax
<script>
$(document).on("click",".save",function(){
e.preventDefault(); //Prevent page from submiting
$(document).on("click", ".save", function() {
$.ajax({
type: "post",
url: 'career_report',
data: $(".why_reporting").serialize(),
success: function(store) {
},
error: function() {
}
});
});
});
</script>
My controller
public function careerReport(requ $request)
{
$report = \App\Reports::create([
'user_id' => $request['user_id'],
'user_id_posted' => $request['user_id_posted'],
'career_solution_id' =>$request['career_solution_id'],
'why_reporting' =>$request['why_reporting'],
'why_reporting_message' =>$request['why_reporting_message'],
'additional_message' =>$request['additional_message'],
]);
if($report != ""){
flash('Career solution report submited', 'success');
}else{
flash('Career solution report', 'warning');
}
return Redirect('career_report')->with('message',"success");
}
Your event listener for the click is wrongly declared (you have an event listener declared after the first event is triggered and end up with two event listener on 'click') plus you might have a wrong url in your ajax.
try this
<script>
$('form').on("submit", function(){
e.preventDefault(); //Prevent page from submiting
var data = new FormData(this);
var url = this.action;
var method = this.method;
$.ajax({
type: method,
url: url,
data: data,
success: function(store) {
},
error: function() {
}
});
});
</script>
Related
I have a problem with my multi step form. Whenever I click the "next" button, instead of just the current tab being validated, it validates all the tabs on the form. How can I do to just validate only the current TAB?
If I have a form in each TAB, the validation will work as I want, but then I can't submit all forms at once.
index.php
<div id="rootwizard">
<ul class="nav nav-pills form-wizard-header mb-3">
<li class="nav-item" data-target-form="#one">
<a href="#basic" data-bs-toggle="tab" data-toggle="tab" class="nav-link rounded-0 pt-2 pb-2">
<span>Info</span>
</a>
</li>
<li class="nav-item" data-target-form="#two">
<a href="#first" data-bs-toggle="tab" data-toggle="tab" class="nav-link rounded-0 pt-2 pb-2">
<span>Device</span>
</a>
</li>
</ul>
<div>
<div id="basic">
<form id="one" method="post" action="" class="form-horizontal">
<div class="row mb-3">
<label for="Client_Emp">Cliente/Empresa</label>
<div>
<input type="text" name="Client_Emp" id="Client_Emp" required />
</div>
</div>
</form>
</div>
<div class="tab-pane" id="first">
<form id="two" method="post" action="" class="form-horizontal">
<div class="row mb-3">
<label for="cpu">CPU</label>
<div>
<input type="text" name="cpu" id="Client_Emp" required />
<option></option>
</select>
</div>
</div>
</form>
</div>
<ul class="list-inline wizard mb-0">
<li class="previous list-inline-item">Previous
</li>
<li class="next list-inline-item float-end">Next</li>
</ul>
</div> <!-- tab-content -->
</div> <!-- end #rootwizard-->
Thanks. I managed to solve it with this javascript.
$("#global").submit(function(e) {
var $ch1 = $("#form_info").children();
var $ch2 = $("#form_first").children();
var $ch3 = $("#form_second").children();
var $ch4 = $("#form_third").children();
var $ch5 = $("#form_fourth").children();
var $ch6 = $("#form_fifth").children();
$(this).append($ch1).append($ch2).append($ch3).append($ch4).append($ch5).append($ch6);
$("#global").submit();
});
How do I send HTML email so that it will look nice with Bootstrap 4? When I send mail it looks nice, but when receiver gets it it looks bad.
here's code:
https://jsfiddle.net/bluemilkyh/6m4v9pnf/1/
I'd also like to make footer form (it's about news subscription) when they fill the form and press the button it would save to my database (I have database already which is not localhost...).
code:
<!DOCTYPE html>
<html>
<head>
<title>Stanovanja Fink</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" integrity="sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ" crossorigin="anonymous">
</head>
<!-- navbar -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="http://localhost/stanovanjefink/index.php">Stanovanja Fink</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="http://localhost/stanovanjefink/stanovanjeanja.php">Stanovanje Anja</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://localhost/stanovanjefink/stanovanjealjaz.php">Stanovanje Aljaž</a>
</li>
<li class="nav-item">
<a class="nav-link" href="http://localhost/stanovanjefink/kontakt.php">Kontakt</a>
</li>
</ul>
</form>
</div>
</nav>
<hr>
<body>
<div class="p-3 mb-2 bg-light text-dark container text-center d-flex flex-column align-items-center">
<h2 form-inline justify-content-center>Rezervacija Stanovanje Aljaz</h2>
<br>
<br>
<label ><b>Ime: </b></label>
<input type="text" class=" form-control col-sm-6 " disabled value="" >
<label><b>Priimek: </b></label>
<input type="text" class="form-control col-sm-6 " disabled value="" ><label><b>Telefon: </b></label>
<input type="text" class="form-control col-sm-6" disabled value="">
<label><b>E-mail: </b></label>
<input type="text" class="form-control col-sm-6" disabled value="">
<label><b>Prihod: </b></label>
<input type="text" class="form-control col-sm-6" disabled value="">
<label><b>Odhod: </b></label>
<input type="text" class="form-control col-sm-6" disabled value="">
<label><b>Cena: </b></label>
<input type="text" class="form-control col-sm-6" disabled value="">
<br>
<h3>Informacije </h3>
<p><i class="gdlr-icon fa fa-map-marker"></i><b> Lokacija:</b> Pod Lipovim trotom</p>
<p><i class="gdlr-icon fa fa-phone"></i> <b>Telefon:</b> +36 41 8813 49219 </p>
<p><i class="gdlr-icon fa fa-envelope"></i> <b>Email :</b> +36 41 88213 49912 </p>
<br>
</div>
</body>
<footer class="bg-dark text-center">
<div class="container p-4">
<form action="kontakt.php">
<div class="row d-flex justify-content-center">
<div class="col-auto">
<p class="pt-2" style="color:white;">
<b>Naroci se na novice: </b>
</p>
</div>
<div class="col-md-5 col-12">
<div class="form-outline form-white mb-4">
<input type="email" placeholder="email" name="novice" class="form-control" required>
</div>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-outline-light mb-4">
Narocite se
</button>
</div>
</div>
<section class="mb-4">
<a class="btn btn-outline-light btn-floating m-1" href="#!" role="button"
><i class="fab fa-facebook-f"></i
></a>
<a class="btn btn-outline-light btn-floating m-1" href="#!" role="button"
><i class="fab fa-twitter"></i
></a>
<a class="btn btn-outline-light btn-floating m-1" href="#!" role="button"
><i class="fab fa-instagram"></i></a>
</section>
</form>
</div>
<div class="text-center p-3" style="background-color:black; color:gray;">
© 2020 Stanovanja Fink
</div>
</div>
</footer>`
I am guessing you are using bootstrap. Use bootstrap for e-mail instead. Web frameworks will NOT play nicely with e-mail. HTML e-mail have different rules and best practices on how to develop markup for it, than classic web sites.
Possibly related:
Look for the top answer here to get a general idea about developing for e-mail: CSS Email Template at Outlook does not display correctly
Here for basic layout: How to make a fluid width email with a max width
I am retrieving some products from the database using PHP and MySQL. I am displaying these products in a carousel. When the user hovers, a "Show Quick Details" button will appear.
When the user clicks that button, a modal shows up displaying the product details.
Example:
Here is the modal when the user clicks.... (no, the products don't match right now, I am using a template the client gave me with example images ).
User Clicks Button:
My question is, how do I go about populating the modal with the correct product information? Do I have to create 10 modals dynamically in my PHP , or is there a better route? I am kinda stumped on how to approach this.
Here is the modal I am using, in case that is helpful for an answer:
<!--====== Quick View Part Start ======-->
<!-- Modal -->
<div class="modal fade " id="productQuickModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<i class="fal fa-times"></i>
</button>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-6">
<div class="product-quick-view-image mt-30">
<div class="quick-view-image">
<div class="single-view-image">
<img src="images/product-17.jpg" alt="product">
</div>
<div class="single-view-image">
<img src="images/product-18.jpg" alt="product">
</div>
<div class="single-view-image">
<img src="images/product-19.jpg" alt="product">
</div>
<div class="single-view-image">
<img src="images/product-20.jpg" alt="product">
</div>
<div class="single-view-image">
<img src="images/product-21.jpg" alt="product">
</div>
</div>
<ul class="quick-view-thumb">
<li>
<div class="single-thumb">
<img src="images/product-17.jpg" alt="">
</div>
</li>
<li>
<div class="single-thumb">
<img src="images/product-18.jpg" alt="">
</div>
</li>
<li>
<div class="single-thumb">
<img src="images/product-19.jpg" alt="">
</div>
</li>
<li>
<div class="single-thumb">
<img src="images/product-20.jpg" alt="">
</div>
</li>
<li>
<div class="single-thumb">
<img src="images/product-21.jpg" alt="">
</div>
</li>
</ul>
</div> <!-- Modal Quick View Image -->
</div>
<div class="col-md-6">
<div class="product-quick-view-content mt-30">
<h3 class="product-title">Trans-Weight Hooded Wind and Water Resistant Shell</h3>
<p class="reference">Reference: demo_12</p>
<ul class="rating">
<li class="rating-on"><i class="fas fa-star"></i></li>
<li class="rating-on"><i class="fas fa-star"></i></li>
<li class="rating-on"><i class="fas fa-star"></i></li>
<li class="rating-on"><i class="fas fa-star"></i></li>
<li class="rating-on"><i class="fas fa-star"></i></li>
</ul>
<div class="product-prices">
<span class="sale-price"> €23.90</span>
<span class="regular-price">€21.03</span>
<span class="save">Save 12%</span>
</div>
<p class="product-description">Block out the haters with the fresh adidas® Originals Kaval Windbreaker Jacket. <br> Part of the Kaval Collection. <br> Regular fit is eased, but not sloppy, and perfect for any activity. <br> Plain-woven jacket specifically constructed for freedom of movement.</p>
<div class="product-size-color flex-wrap">
<div class="product-size">
<h5 class="title">Size</h5>
<select>
<option value="1">S</option>
<option value="2">M</option>
<option value="3">L</option>
<option value="4">XL</option>
</select>
</div>
<div class="product-color">
<h5 class="title">Color</h5>
<div class="color-input">
<div class="single-color color-1">
<input type="radio" id="radio-1" name="color">
<label for="radio-1"></label>
</div>
<div class="single-color color-2">
<input type="radio" id="radio-2" name="color">
<label for="radio-2"></label>
</div>
<div class="single-color color-3">
<input type="radio" id="radio-3" name="color">
<label for="radio-3"></label>
</div>
</div>
</div>
<div class="product-quantity">
<h5 class="title">Quantity</h5>
<div class="quantity d-flex">
<button type="button" id="sub" class="sub"><i class="fal fa-minus"></i></button>
<input type="text" value="1" />
<button type="button" id="add" class="add"><i class="fal fa-plus"></i></button>
</div>
</div>
</div>
<div class="product-add-cart">
<button><i class="icon ion-bag"></i> Add to cart</button>
</div>
<div class="product-wishlist-compare">
<ul class="d-flex flex-wrap">
<li><i class="fal fa-heart"></i> Add to wishlist</li>
<li><i class="fal fa-repeat"></i> Add to compare</li>
</ul>
</div>
<div class="product-share d-flex">
<p>Share</p>
<ul class="social media-body">
<li><i class="fab fa-facebook-f"></i></li>
<li><i class="fab fa-twitter"></i></li>
<li><i class="fab fa-google"></i></li>
<li><i class="fab fa-pinterest-p"></i></li>
</ul>
</div>
</div> <!-- Modal Quick View Content -->
</div>
</div> <!-- row -->
</div> <!-- Modal Body -->
</div> <!-- Modal content -->
</div> <!-- Modal dialog -->
</div> <!-- Modal -->
Any easier ways other than creating x number of modals?
Thank you
I have tried some answers given here on stackoverflow relating to undefined index and session already started, but still dont seem to get whats wrong.
the below code is the whole code in the index.php file
Please someone should guide me or assist me on what im doing wrongly or didnt get right.
<?php
// check for minimum PHP version
if (version_compare(PHP_VERSION, '5.3.7', '<')) {
exit('Sorry, this script does not run on a PHP version smaller than 5.3.7 !');
} else if (version_compare(PHP_VERSION, '5.5.0', '<')) {
// if you are using PHP 5.3 or PHP 5.4 you have to include the password_api_compatibility_library.php
// (this library adds the PHP 5.5 password hashing functions to older versions of PHP)
require_once('./php-login-advanced-master/libraries/password_compatibility_library.php');
}
// include the config
require_once('./php-login-advanced-master/config/config.php');
// include the to-be-used language, english by default. feel free to translate your project and include something else
require_once('./php-login-advanced-master/translations/en.php');
// include the PHPMailer library
require_once('./php-login-advanced-master/libraries/PHPMailer.php');
// load the login class
require_once('./php-login-advanced-master/classes/Login.php');
// load match class
require_once('./php_scrips/matching.php');
// load the registration class
require_once('./php-login-advanced-master/classes/Registration.php');
// create the registration object. when this object is created, it will do all registration stuff automatically
// so this single line handles the entire registration process.
$registration = new Registration();
// create a login object. when this object is created, it will do all login/logout stuff automatically
// so this single line handles the entire login process.
$login = new Login();
//create a match object
$match = new match();
?>
<body>
<ul class="nav navbar-right top-nav">
<li class="dropdown">
<i class="fa fa-user"></i> <?php echo $_SESSION[user_name] ?> <b class="caret"></b>
<ul class="dropdown-menu">
<?php
if(isset($_SESSION['user_email'])){
echo '
<li><i class="fa fa-dashboard"></i> My Dashboard</li>
<li><i class="fa fa-user"></i> My Profile</li>';
if($_SESSION['user_level']=='ADMINISTRATOR'){
echo '<li>Rematch Member</li>
<li>Set User Recovery Question</li>
<li>Rematch Admins</li>';
}
echo '
<li><i class="fa fa-warning"></i> Pending Payments</li>
<li><i class="fa fa-money"></i> Paid Members</li>
<li class="divider"></li>
<li>
<i class="fa fa-fw fa-power-off"></i> Log Out
</li>';
}?>
</ul>
</li>
</ul>
<?php
if(isset($_SESSION['user_email'])){
echo '<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li class="active"><i class="fa fa-dashboard"></i> My Dashboard</li>
<li><i class="fa fa-user"></i> My Profile</li>';
if($_SESSION['user_level']=='ADMINISTRATOR'){
echo '<li>Rematch Member</li>
<li>Set User Recovery Question</li>
<li>Rematch Admins</li>';
}
echo '
<li><i class="fa fa-warning"></i> Pending Payments</li>
<li><i class="fa fa-money"></i> Paid Members</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Dashboard <small>Statistics Overview</small>
</h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-dashboard"></i> Dashboard
</li>
</ol>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<i class="fa fa-info-circle"></i> <strong>Please note that your account will be automatically deleted once you complete your cycle.<br/>To continue with the TapFortune system for the 2nd or as many times as posible, you have to register for every cycle.
</div>
</div>
</div>
<!-- /.row -->';
$match->to_pay($_SESSION['user_to_pay'],$_SESSION['user_status']);
$match->to_get($_SESSION['user_email'],$_SESSION['user_status']);
echo '<!--
<div class="row">
<div class="col-lg-4">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><i class="fa fa-clock-o fa-fw"></i> Last 10 Sign Ups</h3>
</div>
<div class="panel-body">
<div class="list-group">
<a href="#" class="list-group-item">
<span class="badge">just now</span>
<i class="fa fa-fw fa-user"></i> Egere Samuel
</a>
<a href="#" class="list-group-item">
<span class="badge">just now</span>
<i class="fa fa-fw fa-user"></i> Egere Samuel
</a>
<a href="#" class="list-group-item">
<span class="badge">just now</span>
<i class="fa fa-fw fa-user"></i> Egere Samuel
</a>
<a href="#" class="list-group-item">
<span class="badge">just now</span>
<i class="fa fa-fw fa-user"></i> Egere Samuel
</a>
</div>
<div class="text-right">
See More <i class="fa fa-arrow-circle-right"></i>
</div>
</div>
</div>
</div>
</div>-->
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->';
}
if(!isset($_SESSION['user_email']) && !isset($_GET['reg']) && !isset($_GET['password_rest']) && !isset($_SESSION['user_reset'])){
echo '<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li class="active">Login</li>
<li>Sign Up</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Login
</h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-dashboard"></i> Login
</li>
</ol>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-xs-1 col-sm-3 col-md-3 col-lg-4"></div>
<div class="col-xs-10 col-sm-6 col-md-6 col-lg-4" style="margin-bottom:200px">'
.$registration->messages['recovery_reset_successful'].'
<form method="post" enctype="application/x-www-form-urlencoded">
<div class="form-group">
<label for="username">Email</label>
<input type="text" name="user_name" class="form-control" placeholder="Enter Email">
</div>'
.$login->errors['invalid_email'].'
<div class="form-group">
<label for="username">Password</label>
<input type="password" name="user_password" class="form-control" placeholder="Enter Password">
</div>'
.$login->errors['Login_failed'].$login->errors['wrong_password'].'
<div class="checkbox">
<label>
<input type="checkbox" name="user_rememberme" value="1">
Remember me </label>
</div>
<div>
<input type="submit" name="login" value="Sign In" class="btn btn-success btn-block" style="font-size:18px; font-weight:900" />
</div>
<div>
Forgotten password
</div>
</form>
</div>
<div class="col-xs-1 col-sm-3 col-md-3 col-lg-4"></div>
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->';
}
if(!isset($_SESSION['user_email']) && isset($_GET['password_rest'])){
echo '<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li class="active">Login</li>
<li>Sign Up</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Password Reset
</h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-dashboard"></i> Password Reset
</li>
</ol>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-xs-1 col-sm-3 col-md-3 col-lg-4"></div>
<div class="col-xs-10 col-sm-6 col-md-6 col-lg-4" style="margin-bottom:200px">
<form method="post" enctype="application/x-www-form-urlencoded">
<div class="form-group">
<label for="username">Email</label>
<input type="text" name="user_email" class="form-control" placeholder="Enter Email">
</div>'
.$registration->errors['user_email_error'].'
<div class="form-group">
<label for="user_question">Recovery Question:
<select name="user_question" class="form-control">
<option value="" selected="selected">select Recovery Question</option>
<option value="1">My pets name</option>
<option value="2">Mothers maiden name</option>
<option value="3">My First car</option>
<option value="4">My favourite uncle\'s name</option>
<option value="5">My favourite childs name</option>
</select>
</label>
'.$registration->errors['recovery_question'].'
</div>
<div class="form-group">
<label for="user_answer">Answer:
<input type="text" name="user_answer" class="form-control"/>
'.$registration->errors['recovery_answer'].'
</label>
</div>
<div>
<input type="submit" name="verify_me" value="Verify Me" class="btn btn-success btn-block" style="font-size:18px; font-weight:900" />
</div>
</form>
</div>
<div class="col-xs-1 col-sm-3 col-md-3 col-lg-4"></div>
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->';
}
if(!isset($_SESSION['user_email']) && isset($_SESSION['user_reset'])){
echo '<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li class="active">Login</li>
<li>Sign Up</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Password Reset
</h1>
<ol class="breadcrumb">
<li class="active">
<i class="fa fa-dashboard"></i> Password Reset
</li>
</ol>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-xs-1 col-sm-3 col-md-3 col-lg-4"></div>
<div class="col-xs-10 col-sm-6 col-md-6 col-lg-4" style="margin-bottom:200px">'
.$registration->messages['recovery_reset_successful'].'
<form method="post" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="user_email" value="'.$_SESSION['user_reset'].'">
<div class="form-group">
<label for="username">New Password</label>
<input type="text" name="user_password" class="form-control" placeholder="Enter New Password">
</div>
<div class="form-group">
<label for="username">Repeat Password</label>
<input type="text" name="user_password_repeat" class="form-control" placeholder="Repeat New Password">
</div>'
.$registration->errors['user_password_error'].''
.$registration->errors['user_password_repeat_error'].'
<div>
<input type="submit" name="password_rest" value="Reset Password" class="btn btn-success btn-block" style="font-size:18px; font-weight:900" />
</div>
</form>
</div>
<div class="col-xs-1 col-sm-3 col-md-3 col-lg-4"></div>
</div>
<!-- /.row -->
</div>
<!-- /.container-fluid -->
</div>
<!-- /#page-wrapper -->';
}
if(!isset($_SESSION['user_email']) && isset($_GET['reg'])){
echo '<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav">
<li>Login</li>
<li class="active">Sign Up</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Sign Up
<div class="alert alert-warning alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<div class="row">
<div class="col-lg-12">
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<i class="fa fa-info-circle"></i> <strong>Please we advice you have your mobile banking available to you in order to avoid being removed from the system due to inability to pay in 24 hours.
</div>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-xs-12 col-sm-10" style="padding-top:30px; padding-bottom:5px">
'.$registration->messages['success'].'
'.$registration->errors['registration_error'].'
<form method="post">
<label for="mobile_number">Phone:
<input type="text" name="mobile_number" class="form-control" />
'.$registration->errors['mobile_number_error'].'
</label><br />
<label for="user_email">Email:
<input type="email" name="user_email" class="form-control"/>
'.$registration->errors['user_email_error'].'
</label><br />
<label for="user_password_new">Password:
<input type="password" name="user_password_new" class="form-control"/>
'.$registration->errors['user_password_error'].'
</label><br />
<label for="user_password_repeat">Repeat Password:
<input type="password" name="user_password_repeat" class="form-control" />
'.$registration->errors['user_password_repeat_error'].'
</label><br />
<label for="user_amount">Amount to Cycle:
<select name="user_amount" class="form-control">
<option value="" selected="selected">Amount to cycle</option>
<option value="10,000">N 10,000</option>
<option value="20,000">N 20,000</option>
<option value="50,000">N 50,000</option>
<option value="100,000">N 100,000</option>
</select>
'.$registration->errors['user_amount_error'].'
</label><br />
<label for="user_name">Account Name(Name As it shows in your account):
<input type="text" name="user_name" class="form-control"/>
'.$registration->errors['user_name_error'].'
</label><br />
<label for="user_account_number">Account Number:
<input type="number" name="user_account_number" class="form-control"/>
'.$registration->errors['user_account_number_error'].'
</label><br />
<label for="user_bank_name">Bank Name:
<input type="text" name="user_bank_name" class="form-control"/>
'.$registration->errors['user_bank_name_error'].'
</label><br />
<label for="email">Country:
<select name="country" class="form-control">
<option value="Nigeria" selected="selected">Nigeria</option>
</select>
'.$registration->errors['country_error'].'
</label><br />
<label for="user_question">Recovery Question:
<select name="user_question" class="form-control">
<option value="" selected="selected">select Recovery Question</option>
<option value="1">My pets name</option>
<option value="2">Mothers maiden name</option>
<option value="3">My First car</option>
<option value="4">My favourite uncle\'s name</option>
<option value="5">My favourite childs name</option>
</select>
</label><br />
'.$registration->errors['recovery_question'].'
<label for="user_answer">Answer:
<input type="text" name="user_answer" class="form-control"/>
'.$registration->errors['recovery_answer'].'
</label><br />
<img src="./php-login-advanced-master/tools/showCaptcha.php" alt="captcha" /><br />
<label for="captcha">Enter the captcha above
<input type="text" name="captcha" required class="form-control"/>
</label>
'.$registration->errors['captcha_error'].'<br />
<input type="submit" name="register" value="SIGN UP" class="btn btn-success"/>
</form>
';
}?>
Registration.php session part
public function __construct()
{
session_start();
// if we have such a POST request, call the registerNewUser() method
if (isset($_POST["register"])) {
$this->registerNewUser($_POST['user_name'], $_POST['user_email'], $_POST['user_password_new'], $_POST['user_password_repeat'], $_POST["captcha"], $_POST['mobile_number'],$_POST['country'],$_POST['user_account_number'],$_POST['user_bank_name'],$_POST['user_question'],$_POST['user_answer'],$_POST['user_amount']);
}
// if we have such a POST request, call the verifyUser() method
if (isset($_POST["verify_me"])) {
$this->verifyUser($_POST['user_email'], $_POST['user_question'], $_POST['user_answer']);
}
// if we have such a POST request, call the reset_recovery() method
if (isset($_POST["reset_recovery"])) {
$this->reset_recovery($_POST['user_email'], $_POST['user_question'], $_POST['user_answer']);
}
// if we have such a POST request, call the reset_recovery() method
if (isset($_POST["password_rest"])) {
$this->reset_password($_POST['user_email'], $_POST['user_password'], $_POST['user_password_repeat']);
}
}
Session was also stated in the login file...
This is the error message i get:
PHP Notice: A session had already been started - ignoring session_start() in php-login-advanced-master/classes/Registration.php on line 39
PHP Notice: Use of undefined constant user_name - assumed 'user_name' in index.php on line 125
PHP Notice: Undefined index: user_name in index.php on line 125
PHP Notice: Undefined index: recovery_reset_successful in index.php on line 272
PHP Notice: Undefined index: invalid_email in index.php on line 278
PHP Notice: Undefined index: Login_failed in index.php on line 283
PHP Notice: Undefined index: wrong_password in index.php on line 283
I was trying to use a modal. When I try to click the modal, it doesn't get focused. I'm calling the modal in the top bar navigation that is dropdown(located in the top right side). I have uploaded a photo, the link is under the code. I'm using bootstrap. I got the snippet from here
My code:
<ul class="nav navbar-right top-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Admin User <b class="fa fa-angle-down">
</b></a>
<ul class="dropdown-menu">
<!--=====HERE IS WHERE I CALL THE MODAL=====-->
<li>
<a href="#" data-toggle="modal" data-target="#changeProfile"><i class="fa fa-fw fa-cog">
</i> Change Profile</a>
</li>
<li class="divider">
</li>
<li>
<a href="#"><i class="fa fa-fw fa-power-off">
</i> Logout</a>
</li>
</ul>
</li>
</ul>
<!-- Modal Add Brand -->
<div class="modal fade" id="changeProfile" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h3>
Change Profile
</h3>
</div>
<div class="modal-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="txtBusName" class="col-sm-2 control-label">Username</label>
<div class="col-sm-10">
<input type="text" id="txtUsername" class="form-control">
</div>
</div>
<div class="form-group">
<label for="txtBusDesc" class="col-sm-2 control-label">Password</label>
<div class="col-sm-10">
<input type="password" id="txtPassword" class="form-control">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Submit</button>
</div>
</div>
</div>
</div>
<!-- Modal Add Brand -->
This is what it looks like. I can't click the modal at all.
Thanks!
Seems like your modal box's z-index value is lower than the half-transparent dark div that is used to "block" the page content. Try increasing your modal box's z-index value.
#changeProfile {
z-index: 9999;
}