Getting html value and use it in controller Laravel php - php

<div class="form-group col-md-12" style="display:flex;">
<label style="margin-right:10px;">Items<span class="text-danger">*</span></label>
<select style="margin-right:10px;" name="product_id" id="product_id" class="btn btn-primary" type="text">
#foreach ($listitem as $ll)
<option id="itemname" value="{{$ll->id}}">{{$ll->name}} -- {{number_format($ll->price)}}</option>
#endforeach
</select>
<label style="margin-right:10px;">Qty<span class="text-danger">*</span></label>
<input type="number" class="form-control" required name="qty">
</div>
<div class="form-group col-md-12">
<label>Price : </label>
<label for="">{{number_format($ll->price)}}</label>
</div>
How do I get the item dropdown menu id database and I will call it the id for a price where id = id from the value dropdown item name that every time I choose the dropdown item the id will change too so the price will also change depends on the id database from the drop-down menu.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<title></title>
</head>
<body>
<script>
$(document).ready(function (){
$('.selectedOption').on('click',function(){
var price = $(this).find(':selected').data('price');
$('#priceLable').text(price);
})
});
</script>
<div class="form-group col-md-12" style="display:flex;">
<label style="margin-right:10px;">Items<span class="text-danger">*</span></label>
<select style="margin-right:10px;" name="product_id" id="product_id" class="btn btn-primary selectedOption" type="text">
{{-- #foreach ($listitem as $ll)--}}
<option id="itemname" value="1" data-price="100">Name1 -- 100</option>
<option id="itemname" value="2" data-price="150">Name2 -- 150</option>
{{-- #endforeach--}}
</select>
<label style="margin-right:10px;">Qty<span class="text-danger">*</span></label>
<input type="number" class="form-control" required name="qty">
</div>
<div class="form-group col-md-12">
<label>Price : </label>
<label for="" id="priceLable">0</label>
</div>
</div>
</body>
</html>
NOTE: I have hardcoded values you can add them dynamically
First add data-price="{{number_format($ll->price)}}" attribute to options in select
Assign ID to label <label for="" id="priceLable">{{number_format($ll->price)}}</label>
Then write a jQuery code to get value from the data attribute of the selected item and set it to label...
<script>
$(document).ready(function (){
$('.selectedOption').on('click',function(){
var price = $(this).find(':selected').data('price');
$('#priceLable').text(price);
})
});

Related

Submit form with a drop-down list

I got an HTML-form with a drop-down list of products. When you select a product, you will have a new input field appear. For each product type input fields are different. For example: a book will have a new input field of weight, DVD will have a new input field of size and furniture will have inputs of HxWxL dimensions.
So here is the question: how is it better to submit a form to MySQL with different product types so that they are saved in one table? Without the use of if-else and switch statements.
P.S. I am sorry if this question might be asked before here.
P.S.S. And yes, code/name and price inputs are by default with each new product type.
Here is my database related code:
<?php
$mysqli = new mysqli('localhost', 'root', '', 'things') or die(mysqli_error($mysqli));
if (isset($_POST['save'])) {
$code= $_POST['code'];
$name = $_POST['name'];
$price = $_POST['price'];
$mysqli->query("INSERT INTO products (code, name, price) VALUES('$code', '$name', '$price')") or die($mysqli->error);
And here is my form:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Add</title>
<link rel="stylesheet" href="css/add.css">
</head>
<body>
<h1>Add</h1>
<hr>
<?php require_once 'connect.php'; ?>
<div class="container">
<!--FORM-->
<form id="form" action="connect.php" method="POST">
<!--CODE-->
<div id="form-group">
<label for="code" id="code-label"> Code</label>
<input type="text" id="code" name="code" required>
</div>
<!--NAME-->
<div id="form-group">
<label for="name" id="name-label"> Name </label>
<input type="text" id="name" name="name" required>
</div>
<!--PRICE-->
<div id="form-group">
<label for="price" id="price-label"> Price </label>
<input type="number" id="price" name="price" required>
</div>
<div id="form-group">
<label for="product-type" id="product-type-label"> Type Switcher </label>
<select name="product-type" id="product-type" onchange="showHide()">
<option selected hidden value="">Type Switcher</option>
<option value="dvd">DVD</option>
<option value="furniture">Furniture</option>
<option value="book">Book</option>
</select>
</div>-->
<!--HIDDEN INPUTS-->
<div id="size" style="display: none">
<div id="form-group">
<label for="size" id="size-label"> Size </label>
<input type="number" name="size" required>
</div>
</div>
<div id="height" style="display: none">
<div id="form-group">
<label for="height" id="height-label"> Height </label>
<input type="number" name="height" required>
</div>
</div>
<div id="width" style="display: none">
<div id="form-group">
<label for="width" id="width-label"> Width </label>
<input type="number" name="width" required>
</div>
</div>
<div id="length" style="display: none">
<div id="form-group">
<label for="length" id="length-label"> Length </label>
<input type="number" name="length" required>
</div>
</div>
<div id="weight" style="display: none">
<div id="form-group">
<label for="weight" id="weight-label"> Weight </label>
<input type="number" name="weight" required>
</div>
</div>
<button type="submit" name="save">Save</button>
</form>
</div>
<script src="javascript/scripts.js"></script>
</body>
</html>

How to use html div tag and php to interact with the mysql database

I am using an html with div tag to do a booking system asking user input for city, date, and pet type then check the criteria from users to the SQL database, I know how to deal with just html but I am totally lost when dealing with html div tags.
Can anyone show me how to take the user inputs (city, date, and pet type) using php in the right place so i can pass it to the database to check
<div class="form-group">
<span class="form-label">Where do you work? </span>
<input class="form-control" type="text" placeholder="Please enter your city">
</div>
<!-- date picker -->
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span class="form-label">Please take care of my pet on</span>
<input class="form-control" type="date", id="pickup" required>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span class="form-label">Pet?</span>
<select class="form-control">
<option>Cat</option>
<option>Dog</option>
<option>Others</option>
</select>
<span class="select-arrow"></span>
</div>
</div>
</div>
<div class="form-btn">
<button class="submit-btn">Check availability</button>
</div>
First of all, your inputs ,buttons,select,radio buttons..etc must be inside a form tag
<form method="post/get" action="file.php">
Secondly, all your inputs need to have a name to retrieve their values. For exemple :
<input type="text" name="firstname">
And finally, it's better to giver every option in select tag a value:
<select class="form-control" name="pet">
<option value="cat">Cat</option>
<option value="dog">Dog</option>
<option value="others">Others</option>
</select>
Changed work :
<form method="post" action"file.php">
<div class="form-group">
<span class="form-label">Where do you work? </span>
<input class="form-control" type="text" placeholder="Please enter your city" name="city">
</div>
<!-- date picker -->
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span class="form-label">Please take care of my pet on</span>
<input class="form-control" type="date", id="pickup" name="pickup" required>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span class="form-label">Pet?</span>
<select class="form-control" name="pet">
<option value="cat">Cat</option>
<option value="dog">Dog</option>
<option value="others">Others</option>
</select>
<span class="select-arrow"></span>
</div>
</div>
</div>
<div class="form-btn">
<button class="submit-btn">Check availability</button>
</div>
</form>
In your file.php you need to retrieve data with $_POST :
<?php
$city=$_POST['city'];
$date=$_POST['pickup'];
$pet=$_POST['pet'];
?>
First of all, you have to wrap all this code in <form></form> tag:
<form method="post" action="path_to_your_php_handler">
<div class="form-group">
<!-- other stuff -->
<button type="submit" class="submit-btn">Check availability</button>
</div>
</form>
Also, all your inputs should have an unique attribute name, like <input class="form-control" type="date", id="pickup" name="date" required>
Than, in your php file, you can find your input values in array $_POST, like $_POST['date'] from the input with name 'date'.

how to use different forms in one blade file in laravel 5.6

I am using laravel 5.6 and I am developing auto classifieds web application. in My app I have 3 different vehicle categories as car, van, truck and I have blade file to select this three different vehicle types. when I select this vehicles my urls show like this,
http://localhost:8000/post-ad/Truck/8 <- this is category id
http://localhost:8000/post-ad/van/7
http://localhost:8000/post-ad/Car/5
now when I clicked one of above vehicle category page redirect to show.blade.php file, so, now I need 3 different forms to submit data to each vehicles, this is my vehicles form, car form
<form method="post" action="{{url('form')}}" enctype="multipart/form-data">
{{csrf_field()}}
<input type="hidden" id="cid" name="cid" value="{{ $catagories->id }}" />
<div class="form-group">
<label for="exampleFormControlSelect1">District</label>
<select class="form-control" id="exampleFormControlSelect1" name="district">
</select>
</div>
<div class="form-group">
<label for="exampleFormControlSelect1">Town</label>
<select class="form-control" id="exampleFormControlSelect1" name="town">
</select>
</div>
<div class="form-group">
<label for="exampleFormControlSelect1">Brand</label>
<select class="form-control" id="exampleFormControlSelect1" name="brand">
</select>
</div>
<div class="form-group">
<label for="exampleFormControlSelect1">Model</label>
<select class="form-control" id="exampleFormControlSelect1" name="model">
</select>
</div>
</form>
van form
<form method="post" action="{{url('form')}}" enctype="multipart/form-data">
{{csrf_field()}}
<input type="hidden" id="cid" name="cid" value="{{ $catagories->id }}" />
<div class="form-group">
<label for="exampleFormControlSelect1">District</label>
<select class="form-control" id="exampleFormControlSelect1" name="district">
</select>
</div>
<div class="form-group">
<label for="exampleFormControlSelect1">Town</label>
<select class="form-control" id="exampleFormControlSelect1" name="town">
</select>
</div>
<div class="form-group">
<label for="exampleFormControlSelect1">Brand</label>
<select class="form-control" id="exampleFormControlSelect1" name="brand">
</select>
</div>
<div class="form-group">
<label for="exampleFormControlSelect1">Model</label>
<select class="form-control" id="exampleFormControlSelect1" name="model">
</select>
</div>
</form>
Truck Form
<form method="post" action="{{url('form')}}" enctype="multipart/form-data">
{{csrf_field()}}
<input type="hidden" id="cid" name="cid" value="{{ $catagories->id }}" />
<div class="form-group">
<label for="exampleFormControlSelect1">District</label>
<select class="form-control" id="exampleFormControlSelect1" name="district">
</select>
</div>
<div class="form-group">
<label for="exampleFormControlSelect1">Town</label>
<select class="form-control" id="exampleFormControlSelect1" name="town">
</select>
</div>
<div class="form-group">
<label for="exampleFormControlSelect1">Brand</label>
<select class="form-control" id="exampleFormControlSelect1" name="brand">
</select>
</div>
<div class="form-group">
<label for="exampleFormControlSelect1">Model</label>
<select class="form-control" id="exampleFormControlSelect1" name="model">
</select>
</div>
</form>
I need show each form when some user click each vehicle links on one blade file. how can I do this?
You may add name to your routes, for example:
Route::group(['prefix' => 'post-ad'], function () {
Route::get('Truck/{id}', 'TruckController#fetch')->name('track');
Route::get('Van/{id}', 'VanController#fetch')->name('van');
Route::get('Car/{id}', 'CarController#fetch')->name('car');
})
Put your form to another files like:
truck-form.blade.php
van-form.blade.php
car-form.blade.php
In your view:
#if(request()->route()->getName() = 'track')
#include('truck-form')
#elseif(request()->route()->getName() = 'van')
#include('van-form')
#elseif
#include('van-form')
#endif

Concatenate String in php

When i click on Add buttton it adds the dropdown selected text to the bottom textbox. and again when i change the value of dropdown and click on add. It rewrites the in textbox. I want to concatenate with previous value of the textbox with comma saparated whenever i click on add
Im new to php.
<?php
if(isset($_POST["in_submit"]))
{
$i1=$_POST['name'];
$i2=$_POST['dose'];
$i3 = $i1."*".$i2;
}
?>
<html>
<head>
<title>
</title>
</head>
<body>
<form action="#" class="form-horizontal" method="post" accept-charset="utf-8">
<label for="inputEmail3" class="col-md-4 control-label">Name</label>
<select name="name" class="form-control" style="width:30%;">
<option value="Select">--SELECT--</option>
<option value="abc">abc</option>
<option value="def">def</option>
</select>
<input type="text" name="dose" value="" class="form-control"/>
<div class="col-sm-2">
<input type="submit" name="in_submit" value="Add" class="btn-danger" style="height:30px;width:60px;padding-top:2px;border-radius:5px"/>
</div>
</form>
<div class="col-sm-7">
<input type="text" name="text" value="<?php if(isset($i3)){ echo $i3;}?>" class="form-control" readonly />
</div>
</body>
</html>
Is because $i2=$_POST['dose']; is always empty
value="<?php if(isset($i3)){ echo $i3;}?>"
should be part of dose
After some changes You don't need to use dose you can concatenate like this -> if you get the solution then vote up.
<?php
if(isset($_POST["in_submit"]))
{
$i1=$_POST['name'];
$i2=$_POST['text'];
if($i2!=''){
$i3 = $i2.",".$i1;
}else{
$i3 = $i1;
}
}
?>
<html>
<head>
<title>
</title>
</head>
<body>
<form action="#" class="form-horizontal" method="post" accept-charset="utf-8">
<label for="inputEmail3" class="col-md-4 control-label">Name</label>
<select name="name" class="form-control" style="width:30%;">
<option value="Select">--SELECT--</option>
<option value="abc">abc</option>
<option value="def">def</option>
</select>
<div class="col-sm-2">
<input type="submit" name="in_submit" value="Add" class="btn-danger" style="height:30px;width:60px;padding-top:2px;border-radius:5px"/>
</div>
<div class="col-sm-7">
<input type="text" name="text" value="<?php if(isset($i3)){ echo $i3;}?>" class="form-control" readonly />
</div>
</form>
</body>
</html>

Login Butto returning to the same page. Instead of Home

Iam creating a page. The sign up works fine and takes me to home page but after logging out and trying to login again. The login button redirects me back to the registration page.
Please Help! I have checked through over and over and cant find any error.
login.php
<?php
if(isset($_POST['Login']))
{error_reporting(1);
$connection = mysqli_connect('localhost','root','','uni-saga');
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$user=$_POST['username'];
$pass=$_POST['password'];
$que1=mysqli_query($connection,"select * from users where Email='$user' and Password='$pass'");
$count1=mysqli_num_rows($que1);
if($count1>0)
{
session_start();
$_SESSION['tempsagauser']=$user;
$que6=mysqli_query("select * from users where Email='$user'");
$rec6=mysqli_fetch_array($que6);
$userid=$rec6[0];
$que2=mysqli_query($connection,"select * from user_profile_pic where user_id=$userid");
$count2=mysqli_num_rows($que2);
if($count2>0)
{
$que3=mysqli_query($connection,"select * from user_secret_quotes where user_id=$userid");
$count3=mysqli_num_rows($que3);
if($count3>0)
{
$que4=mysqli_query($connection,"select * from user_secret_quotes where user_id=$userid");
while($rec=mysqli_fetch_array($que4))
{
$que2=$rec[3];
$ans2=$rec[4];
}
if($que2=="" && $ans2=="")
{
header("location:saga_files/saga_step/saga_step3/Secret_Question2.php");
}
else
{
session_start();
$_SESSION['sagauser']=$user;
$query1=mysqli_query($connection,"select * from users where Email=$user");
$rec1=mysqli_fetch_array($query1);
$userid=$rec1[0];
mysqli_query($connection,"update user_status set status='Online' where user_id='$userid'");
header("location:saga_files/saga_home/Home.php");
}
}
else
{
header("location:saga_files/saga_step/saga_step2/Secret_Question1.php");
}
}
else
{
while($rec=mysqli_fetch_array($que1))
{
$Gender=$rec[4];
}
if($Gender=="Male")
{
header("location:saga_files/saga_step/saga_step1/Step1_Male.php");
}
else
{
header("location:saga_files/saga_step/saga_step1/Step1_Female.php");
}
}
}
else
{
$que5=mysqli_query($connection,"select * from users where Email='$user'");
$count5=mysqli_num_rows($que5);
if($count5>0)
{
header("location:Invalid_Password.php");
}
else
{
header("location:Invalid_Username.php");
}
}
}
?>
index.php
<?php
include("Login.php");
include("saga_files/saga_index_file/saga_SignUp_file/SignUp.php");
?>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>UniSaga</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/ionicons.min.css" />
<link rel="stylesheet" href="css/font-awesome.min.css" />
<!--Google Font-->
<link href="https://fonts.googleapis.com/css?family=Lato:300,400,400i,700,700i" rel="stylesheet">
<!--Favicon-->
<link rel="shortcut icon" type="image/png" href="images/fav.png"/>
</head>
<script>
function time_get()
{
d = new Date();
mon = d.getMonth()+1;
time = d.getDate()+"-"+mon+"-"+d.getFullYear()+" "+d.getHours()+":"+d.getMinutes();
}
</script>
<header id="header-inverse">
<nav class="navbar navbar-default navbar-fixed-top menu">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index-register.html"><img src="images/logo.png" alt="logo" /></a>
</div>
</div>
</nav>
</header>
<div id="lp-register">
<div class="container wrapper">
<div class="row">
<div class="col-sm-5">
<div class="intro-texts">
<h1 class="text-white">UniSaga</h1>
<p>Connect With Students from other Your University and Other Universities and get the latest news on what is Happening Around these learning Institutions. <br /> <br />What Are You Waiting For. Join Now And Experience It Like Never Before.</p>
</div>
</div>
<div class="col-sm-6 col-sm-offset-1">
<div class="reg-form-container">
<div class="reg-options">
<ul class="nav nav-tabs">
<li class="active">Register</li>
<li>Login</li>
</ul><!--Tabs End-->
</div>
<!--Registration Form Contents-->
<div class="tab-content">
<div class="tab-pane active" id="register">
<h3>Register Now !!!</h3>
<p class="text-muted">Its Free and Always Will Be.</p>
<!--Register Form-->
<form method="post" name="registration_form" id='registration_form' class="form-inline">
<div class="row">
<div class="form-group col-xs-6">
<label for="first_name" class="sr-only">First Name</label>
<input id="first_name" class="form-control input-group-lg" type="text" name="first_name" title="Enter first name" placeholder="First name"/>
</div>
<div class="form-group col-xs-6">
<label for="last_name" class="sr-only">Last Name</label>
<input id="last_name" class="form-control input-group-lg" type="text" name="last_name" title="Enter last name" placeholder="Last name"/>
</div>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="email" class="sr-only">Email</label>
<input id="email" class="form-control input-group-lg" type="text" name="email" title="Enter Email" placeholder="Your Email"/>
</div>
<div class="form-group col-xs-12">
<label for="remail" class="sr-only">Re-Enter Email</label>
<input id="remail" class="form-control input-group-lg" type="text" name="remail" title="Enter Email" placeholder="Re-Enter Your Email"/>
</div>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="password" class="sr-only">Password</label>
<input id="password" class="form-control input-group-lg" type="password" name="password" title="Enter password" placeholder="Password"/>
</div>
</div>
<div class="row">
<p class="birth"><strong>Date of Birth</strong></p>
<div class="form-group col-sm-3 col-xs-6">
<label for="month" class="sr-only"></label>
<select name="day" class="form-control" id="Day">
<option value="Day" disabled selected>Day</option>
<script type="text/javascript">
for(i=1;i<=31;i++)
{
document.write("<option value='"+i+"'>" + i + "</option>");
}
</script>
</select>
</div>
<div class="form-group col-sm-3 col-xs-6">
<label for="month" class="sr-only"></label>
<select name="month" class="form-control" id="Month">
<option value="Month" disabled selected>Month</option>
<script type="text/javascript">
var m=new Array("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
for(i=1;i<=m.length-1;i++)
{
document.write("<option value='"+i+"'>" + m[i] + "</option>");
}
</script>
</select>
</div>
<div class="form-group col-sm-6 col-xs-12">
<label for="year" class="sr-only"></label>
<select name="year" class="form-control" id="Year">
<option value="Year" disabled selected>Year</option>
<script type="text/javascript">
for(i=2000;i>=1960;i--)
{
document.write("<option value='"+i+"'>" + i + "</option>");
}
</script>
</select>
</div>
</div>
<div class="form-group gender">
<select name="sex" style="width:120;height:35;font-size:18px;padding:3;">
<option value="Select Sex:"> Select Sex: </option>
<option value="Female"> Female </option>
<option value="Male"> Male </option>
</select>
</div>
<div class="row">
<div class="form-group col-xs-6">
<label for="campus" class="sr-only">Campus</label>
<input id="campus" class="form-control input-group-lg reg_name" type="text" name="campus" title="Enter campus" placeholder="Your campus"/>
</div>
<div class="form-group col-xs-6">
<label for="county" class="sr-only"></label>
<select name="county" class="form-control" id="county">
<option value="county" disabled selected>County</option>
<option value="Baringo">Baringo</option>
<option value="Bomet">Bomet</option>
<option value="Bungoma">Bungoma</option>
<option value="Busia">Busia</option>
<option value="Elgeyo">Elgeyo Marakwet</option>
<option value="Embu">Embu</option>
<option value="Garissa">Garissa</option>
<option value="Homa">Homa Bay</option>
<option value="Isiolo">Isiolo</option>
<option value="Kajiado">Kajiado</option>
<option value="Kakamega">Kakamega</option>
<option value="Kericho">Kericho</option>
<option value="Kiambu">Kiambu</option>
<option value="Kilifi">Kilifi</option>
<option value="Kirinyaga">Kirinyaga</option>
<option value="Kisii">Kisii</option>
<option value="Kisumu">Kisumu</option>
<option value="Kitui">Kitui</option>
<option value="Kwale">Kwale</option>
<option value="Laikipia">Laikipia</option>
<option value="Lamu">Lamu</option>
<option value="Machakos">Machakos</option>
<option value="Makueni">Makueni</option>
<option value="Mandera">Mandera</option>
<option value="Meru">Meru</option>
<option value="Migori">Migori</option>
<option value="Marsabit">Marsabit</option>
<option value="Mombasa">Mombasa</option>
<option value="Muranga">Muranga</option>
<option value="Nairobi">Nairobi</option>
<option value="Nakuru">Nakuru</option>
<option value="Nandi">Nandi</option>
<option value="Narok">Narok</option>
<option value="Nyamira">Nyamira</option>
<option value="Nyandarua">Nyandarua</option>
<option value="Nyeri">Nyeri</option>
<option value="Samburu">Samburu</option>
<option value="Siaya">Siaya</option>
<option value="Taita">Taita Taveta</option>
<option value="Tana">Tana River</option>
<option value="Tharaka">Tharaka Nithi</option>
<option value="Trans">Trans Zoia</option>
<option value="Turkana">Turkana</option>
<option value="Uasin">Uasin Gishu</option>
<option value="Vihiga">Vihiga</option>
<option value="Wajir">Wajir</option>
<option value="West">West Pokot</option>
</select>
</div>
</div>
<button type="submit" name="signup" id="sign_button" class="btn btn-primary" / onClick="time_get()" >Register Now</button>
</form>
</div>
<div class="tab-pane" id="login">
<h3>Login</h3>
<p class="text-muted">Log into your account</p>
<!--Login Form-->
<form method="post" name="Login_form" id='Login_form'>
<div class="row">
<div class="form-group col-xs-12">
<label for="my-email" class="sr-only">Email</label>
<input id="my-email" class="form-control input-group-lg" type="text" name="username" title="Enter Email" placeholder="Your Email"/>
</div>
</div>
<div class="row">
<div class="form-group col-xs-12">
<label for="my-password" class="sr-only">Password</label>
<input id="my-password" class="form-control input-group-lg" type="password" name="password" title="Enter password" placeholder="Password"/>
</div>
</div>
<p>Forgot Password</p>
<button name="Login" id="login_button" class="btn btn-primary">Login Now</button>
</form><!--Login Form Ends-->
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-sm-offset-6">
<!--Social Icons-->
<ul class="list-inline social-icons">
<li><i class="icon ion-social-facebook"></i></li>
<li><i class="icon ion-social-twitter"></i></li>
<li><i class="icon ion-social-googleplus"></i></li>
<li><i class="icon ion-social-pinterest"></i></li>
<li><i class="icon ion-social-linkedin"></i></li>
</ul>
</div>
</div>
</div>
</div>
<!--preloader-->
<div id="spinner-wrapper">
<div class="spinner"></div>
</div>
<!-- Scripts
================================================= -->
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.appear.min.js"></script>
<script src="js/jquery.incremental-counter.js"></script>
<script src="js/script.js"></script>
</body>
</html>
<?php
include("saga_files/saga_index_file/saga_erorr_file/saga_erorr.php");
?>
</body>
</html>
1) Your session doesn't preserve its state, e.g. it's closed immediately after your login.php page finished processing. That happens because you're calling session_start() inside your code in login.php. So, you must move your session_start() to the first line in login.php. No code should reside before it.
And use it ONLY ONCE! (You use session_start twice)
See: PHP session for tracking unique page views
2) Also: Login_form needs an action attribute (login.php). Otherwise the form is posted to the page were it resides, e.g to index.php. So:
<form method="post" action="login.php" name="Login_form" id="Login_form">
3) And there is a typo here (/):
<button type="submit" name="signup" id="sign_button" class="btn btn-primary" / onClick="time_get()" >Register Now</button>
Good luck.

Categories