my file upload code
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Lumino - Dashboard</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/datepicker3.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">
<link href="css/admin.css" rel="stylesheet">
<!--Custom Font-->
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->
<style>
.import {
right: -430px !important;
padding: 25px!important;
}
#media (max-width: 768px) {
.import {
right: 0px !important;
}
.navbar-fixed-bottom,
.navbar-fixed-top {
right: 86px!important;
left: 0;
z-index: 1030;
}
}
</style>
</head>
<body>
<?php include('dbc.php');?>
<nav class="navbar navbar-custom navbar-fixed-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#sidebar-collapse">
<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="#"> <span>Lumino</span>Admin</a>
<ul class="nav navbar-top-links navbar-right">
<li class="dropdown">
<a class="dropdown-toggle count-info" data-toggle="dropdown" href="#">
<em class="fa fa-envelope"></em>
</a>
<ul class="dropdown-menu dropdown-messages">
<li>
<div class="dropdown-messages-box">
<a href="profile.html" class="pull-left">
<img alt="image" class="img-circle" src="http://placehold.it/40/30a5ff/fff">
</a>
<div class="message-body">
<small class="pull-right">3 mins ago</small>
<strong>John Doe</strong> commented on <strong>your photo</strong>.
<br/>
<small class="text-muted">1:24 pm - 25/03/2015</small>
</div>
</div>
</li>
<li class="divider"></li>
<li>
<div class="dropdown-messages-box">
<a href="profile.html" class="pull-left">
<img alt="image" class="img-circle" src="http://placehold.it/40/30a5ff/fff">
</a>
<div class="message-body">
<small class="pull-right">1 hour ago</small>
New message from <strong>Jane Doe</strong>.
<br/>
<small class="text-muted">12:27 pm - 25/03/2015</small>
</div>
</div>
</li>
<li class="divider"></li>
<li>
<div class="all-button">
<em class="fa fa-inbox"></em> <strong>All Messages</strong>
</div>
</li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle count-info" data-toggle="dropdown" href="#">
<em class="fa fa-bell"></em>
</a>
<ul class="dropdown-menu dropdown-alerts">
<li>
<a href="#">
<div><em class="fa fa-envelope"></em> 1 New Message
<span class="pull-right text-muted small">3 mins ago</span></div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<em class="fa fa-heart"></em> 12 New Likes <span class="pull-right ext-muted small">4 mins ago</span>
</div>
</a>
</li>
<li class="divider"></li>
<li>
<a href="#">
<div>
<em class="fa fa-user"></em> 5 New Followers <span class="pull-right text-muted small">4 mins ago</span>
</div>
</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- /.container-fluid -->
</nav>
<div id="sidebar-collapse" class="col-sm-3 col-lg-2 sidebar">
<div class="profile-sidebar">
<div class="profile-userpic">
<img src="http://placehold.it/50/30a5ff/fff" class="img-responsive" alt="">
</div>
<div class="profile-usertitle">
<div class="profile-usertitle-name">Username</div>
<div class="profile-usertitle-status"><span class="indicator label-success"></span>Online</div>
</div>
<div class="clear"></div>
</div>
<div class="divider"></div>
<form role="search">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
</form>
<ul class="nav menu">
<li class="active"><em class="fa fa-dashboard"> </em> Dashboard</li>
<li><em class="fa fa-calendar"> </em> Widgets</li>
<li><em class="fa fa-bar-chart"> </em> Charts</li>
<li><em class="fa fa-toggle-off"> </em> UI Elements</li>
<li><em class="fa fa-clone"> </em> Alerts & Panels</li>
<li class="parent ">
<a data-toggle="collapse" href="#sub-item-1">
<em class="fa fa-navicon"> </em> Multilevel
<span data-toggle="collapse" href="#sub-item-1" class="icon pull-right"><em class="fa fa-plus"></em></span>
</a>
<ul class="children collapse" id="sub-item-1">
<li>
<a class="" href="#">
<span class="fa fa-arrow-right"> </span> Sub Item 1
</a>
</li>
<li>
<a class="" href="#">
<span class="fa fa-arrow-right"> </span> Sub Item 2
</a>
</li>
<li>
<a class="" href="#">
<span class="fa fa-arrow-right"> </span> Sub Item 3
</a>
</li>
</ul>
</li>
<li><em class="fa fa-power-off"> </em> Logout</li>
</ul>
</div>
<!--/.sidebar-->
<div class="col-sm-9 col-sm-offset-3 col-lg-10 col-lg-offset-2
main">
<div class="row">
<ol class="breadcrumb">
<li>
<a href="#">
<em class="fa fa-home"></em>
</a>
</li>
<li class="active">Dashboard</li>
</ol>
</div>
<!--/.row-->
</div>
<div class="container">
<form method="post" role="form" class="impfile">
<h1 class="text-center">IMPORT FILE</h1>
<p class="search_input col-sm-12 import">
<input type="file" placeholder="From Date" id="file" name="file" required class="input-control" />
<br>
<input type="submit" name="import" value="import" id="import" class="btn btn-primary pull-center">
</p>
</form>
</div>
<?php error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE) ?>
<?php
if(isset($_POST["import"])) {
ini_set('max_execution_time', 120); //300 seconds = 5 minutes
//$filename = $_FILES['file']['name'];
$file = $_FILES['file']['tmp_name'];
//$ext=substr($file,strrpos($file,"."),(strlen($file)-
strrpos($file,".");
//if($ext=="csv")
$handle = fopen($file, "r");
//$c = 0;
while(($filesop = fgetcsv($handle,",")) !== false)
{
$category = mysqli_real_escape_string($conn,$filesop[0]);
$tags = mysqli_real_escape_string($conn,$filesop[1]);
$title = mysqli_real_escape_string($conn,$filesop[2]);
$url =mysqli_real_escape_string($conn,$filesop[3]);
$description = mysqli_real_escape_string($conn,$filesop[4]);
$date = mysqli_real_escape_string($conn,$filesop[5]);
//print_r($filesop[0]);
var_dump($filesop);
//echo $filesop[0];
$sql = "insert into report(category,tags,title,url,description,date) values ('$category','$tags','$title','$url','$description','$date')";
//$c = $c + 1;
$result=mysqli_query($conn,$sql)or die($sql."<br/><br/>".mysql_error());
//echo $sql;
//echo $filesop[1];
//echo "success";
exit();
}
//if($result){
//echo " upload success";
//ini_set('auto_detect_line_endings',FALSE);
fclose($handle);
// }
//else
// echo "cannot upload csv file";
}
mysqli_close($conn);
?>
<!--/.main-->
<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/chart.min.js"></script>
<script src="js/chart-data.js"></script>
<script src="js/easypiechart.js"></script>
<script src="js/easypiechart-data.js"></script>
<script src="js/bootstrap-datepicker.js"></script>
<script src="js/custom.js"></script>
<script>
window.onload = function() {
var chart1 = document.getElementById("line-
chart ").getContext("
2 d ");
window.myLine = new Chart(chart1).Line(lineChartData, {
responsive: true,
scaleLineColor: "rgba(0,0,0,.2)",
scaleGridLineColor: "rgba(0,0,0,.05)",
scaleFontColor: "#c5c7cc"
});
};
</script>
</body>
</html>
Below is my csv file data.
Marketing & Customer Analytics,Trends & Product Updates,Segment Launches Segment Select,https://martechseries.com/analytics/customer-data-platforms/segment-launches-segment-select-new-program-help-companies-leverage-first-party-data-certified-partners/,"Segment, the customer data infrastructure company, launched Segment Select, a new program designed to help Channel and Technology Partners easily build and implement solutions for their customers that leverage Segment’s Customer Data Infrastructure (CDI).",2/24/2019
My database table screenshort
You have missed form attribute enctype.
You need to update in form attribute enctype in the form tag.
Your current syntax is:- <form method="post" role="form" class="impfile">
Need to update with :- <form method="post" role="form" class="impfile" enctype="multipart/form-data">
Please check below code:
<form method="post" role="form" class="impfile" enctype="multipart/form-data">
<h1 class="text-center">IMPORT FILE</h1>
<p class="search_input col-sm-12 import">
<input type="file" placeholder="From Date" id="file" name="file" required class="input-control" />
<br>
<input type="submit" name="import" value="import" id="import" class="btn btn-primary pull-center">
</p>
</form>
Updated
Update for If CSV file contains 2 or more rows. Please check below code
while (($row = fgetcsv($handle, ",")) !== false)
{
if (empty($fields)){
$fields = $row;
continue;
}
foreach ($row as $k=>$value)
{
$results[$col][$k] = $value;
}
$col++;
unset($row);
}
if (!feof($handle))
{
echo "Error: unexpected fgets() failn";
}
fclose($handle);
foreach ($results as $key => $value) {
$category = mysqli_real_escape_string($conn,$value[0]);
$tags = mysqli_real_escape_string($conn,$value[1]);
$title = mysqli_real_escape_string($conn,$value[2]);
$url =mysqli_real_escape_string($conn,$value[3]);
$description = mysqli_real_escape_string($conn,$value[4]);
$date = mysqli_real_escape_string($conn,$value[5]);
$sql = "insert into report(category,tags,title,url,description,date) values ('$category','$tags','$title','$url','$description','$date')";
$result=mysqli_query($conn,$sql)or die($sql."<br/><br/>".mysqli_error());
}
I am trying to query the database and get user information.
I use the adminlte System but when I run the view it returns a variable error.
HomeController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use App\Http\Controllers\Controller;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* #return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* #return \Illuminate\Http\Response
*/
public function index()
{
$users = DB::select('select * from users');
return view('vendor.adminlte.page', ['users' => $users]);
}
}
Page.blade.php
#extends('adminlte::master')
#section('adminlte_css')
<link rel="stylesheet"
href="{{ asset('vendor/adminlte/dist/css/skins/skin-' . config('adminlte.skin', 'blue') . '.min.css')}} ">
#stack('css')
#yield('css')
#stop
#section('body_class', 'skin-' . config('adminlte.skin', 'blue') . ' sidebar-mini ' . (config('adminlte.layout') ? [
'boxed' => 'layout-boxed',
'fixed' => 'fixed',
'top-nav' => 'layout-top-nav'
][config('adminlte.layout')] : '') . (config('adminlte.collapse_sidebar') ? ' sidebar-collapse ' : ''))
#section('body')
<div class="wrapper">
<div class="wrapper" style="height: auto; min-height: 100%;">
<header class="main-header">
<!-- Logo -->
<a href="/home" class="logo">
<!-- mini logo for sidebar mini 50x50 pixels -->
<span class="logo-mini"><b>U</b></span>
<!-- logo for regular state and mobile devices -->
<span class="logo-lg"><b>UNIDAS</b></span>
</a>
<!-- Header Navbar: style can be found in header.less -->
<nav class="navbar navbar-static-top">
<!-- Sidebar toggle button-->
<a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="navbar-custom-menu">
<ul class="nav navbar-nav">
<!-- Messages: style can be found in dropdown.less-->
<li class="dropdown messages-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-envelope-o"></i>
<span class="label label-success">4</span>
</a>
<ul class="dropdown-menu">
<li class="header">Você tem 4 mensagens</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- start message -->
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Informática
<small><i class="fa fa-clock-o"></i> 5 minutos</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
<!-- end message -->
<li>
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Financeiro
<small><i class="fa fa-clock-o"></i> 2 horas</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Contabilidade
<small><i class="fa fa-clock-o"></i> Hoje</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Institucional
<small><i class="fa fa-clock-o"></i> Ontem</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
<li>
<a href="#">
<div class="pull-left">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<h4>
Gerência
<small><i class="fa fa-clock-o"></i> 2 Dias</small>
</h4>
<p>Está conseguindo concluir?</p>
</a>
</li>
</ul>
</li>
<li class="footer">Ler todas Mensagens</li>
</ul>
</li>
<!-- Notifications: style can be found in dropdown.less -->
<li class="dropdown notifications-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-bell-o"></i>
<span class="label label-warning">10</span>
</a>
<ul class="dropdown-menu">
<li class="header">Você tem 10 notificações</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li>
<a href="#">
<i class="fa fa-users text-aqua"></i>Não Imprimir Colorido
</a>
</li>
<li>
<a href="#">
<i class="fa fa-warning text-yellow"></i>Nova Reunião Redir
</a>
</li>
<li>
<a href="#">
<i class="fa fa-users text-red"></i>Aviso Copa
</a>
</li>
<li>
<a href="#">
<i class="fa fa-shopping-cart text-green"></i>Data Congresso Internacional
</a>
</li>
<li>
<a href="#">
<i class="fa fa-user text-red"></i> Banco de Horas
</a>
</li>
</ul>
</li>
<li class="footer">Ver todas Notificações</li>
</ul>
</li>
<!-- Tasks: style can be found in dropdown.less -->
<li class="dropdown tasks-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-flag-o"></i>
<span class="label label-danger">9</span>
</a>
<ul class="dropdown-menu">
<li class="header">Você tem 9 tarefas</li>
<li>
<!-- inner menu: contains the actual data -->
<ul class="menu">
<li><!-- Task item -->
<a href="#">
<h3>
Desenvolver Intranet
<small class="pull-right">20%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">20% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
<li><!-- Task item -->
<a href="#">
<h3>
Desenvolver novo layout
<small class="pull-right">40%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-green" style="width: 40%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">40% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
<li><!-- Task item -->
<a href="#">
<h3>
Desenvolver novo Administrador
<small class="pull-right">60%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-red" style="width: 60%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">60% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
<li><!-- Task item -->
<a href="#">
<h3>
Unificar superitêndencias
<small class="pull-right">80%</small>
</h3>
<div class="progress xs">
<div class="progress-bar progress-bar-yellow" style="width: 80%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
<span class="sr-only">80% Complete</span>
</div>
</div>
</a>
</li>
<!-- end task item -->
</ul>
</li>
<li class="footer">
Ver todas Tarefas
</li>
</ul>
</li>
<!-- User Account: style can be found in dropdown.less -->
<li class="dropdown user user-menu">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<img src="images/usuarios/richardnicson.jpg" class="user-image" alt="User Image">
<span class="hidden-xs">Richard Nicson</span>
</a>
<ul class="dropdown-menu">
<!-- User image -->
<li class="user-header">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
<p>
Richard Nicson Costa de Lima - Desenvolvedor Web
<small>Membro desde Agosto. 2018</small>
</p>
</li>
<!-- Menu Footer-->
<li class="user-footer">
<div class="pull-left">
Perfil
</div>
<div class="pull-right">
<a href="#" class="btn btn-default btn-flat" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">
<i class="fa fa-fw fa-power-off"></i> Sair
</a>
<form id="logout-form" action="http://intranet.unidas.org.br/logout" method="POST" style="display: none;">
<input type="hidden" name="_token" value="jmubQRfJenzcLKmbpvyjeMCVeafWedS5IPC36tmk">
</form>
</div>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</header>
#if(config('adminlte.layout') != 'top-nav')
<!-- Left side column. contains the logo and sidebar -->
<aside class="main-sidebar">
<!-- sidebar: style can be found in sidebar.less -->
<section class="sidebar">
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="images/usuarios/richardnicson.jpg" class="img-circle" alt="User Image">
</div>
<div class="pull-left info">
<p>Richard Nicson</p>
<i class="fa fa-circle text-success"></i> Online
</div>
</div>
<!-- search form -->
<form action="#" method="get" class="sidebar-form">
<div class="input-group">
<input type="text" name="q" class="form-control" placeholder="Pesquisar...">
<span class="input-group-btn">
<button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
</button>
</span>
</div>
</form>
<!-- /.search form -->
<!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu tree" data-widget="tree">
#each('adminlte::partials.menu-item', $adminlte->menu(), 'item')
</ul>
</section>
<!-- /.sidebar -->
</aside>
#endif
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" style="min-height: 1265px;">
#if(config('adminlte.layout') == 'top-nav')
<div class="container">
#endif
<!-- Content Header (Page header) -->
<section class="content-header">
#yield('content_header')
</section>
<!-- Main content -->
<section class="content">
#yield('content')
</section>
<!-- /.content -->
#if(config('adminlte.layout') == 'top-nav')
</div>
<!-- /.container -->
#endif
</div>
<!-- /.content-wrapper -->
</div>
<!-- ./wrapper -->
#stop
#section('adminlte_js')
<script src="{{ asset('vendor/adminlte/dist/js/adminlte.min.js') }}"></script>
#stack('js')
#yield('js')
#stop
Error:
ErrorException (E_ERROR) Undefined variable: adminlte (View:
/home/unidas/intranet/resources/views/vendor/adminlte/page.blade.php)
<div class="container">
<!-- TOP -->
<?php var_dump($products['upper']); ?>
<div class="row" style="margin-top: 20px">
<div class="col-md-offset-3 col-md-6">
<h4 class="text-center"><small>STEP 1:</small> Choose your TOP</h4>
<div id="top-carousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<?php foreach ($products['upper'] as $index => $product): ?>
<div class="item <?php echo ($index == 0) ? 'active' : ''; ?>">
<img name="data" value="<?php echo $product['productID'] ?>" class="img-responsive center-block" src="<?php echo base_url();?>image/productimages/<?php echo $product['image'] ?>" style="margin: auto; height: 300px">
<div class="carousel-caption" style="padding: 10px; background-color: black; color: white;">
<?php echo $product['productname']; ?>
</div>
</div>
<?php endforeach ?>
</div>
<a class="left carousel-control" href="#top-carousel" role="button" data-slide="prev">
<i class="fa fa-lg fa-arrow-left" style="top: 45%; position: absolute; color: #000"></i>
</a>
<a class="right carousel-control" href="#top-carousel" role="button" data-slide="next">
<i class="fa fa-lg fa-arrow-right" style="top: 45%; position: absolute; color: #000"></i>
</a>
</div>
</div>
</div>
<?php var_dump($products['lower']); ?>
<!-- BOTTOM -->
<div class="row">
<div class="col-md-offset-3 col-md-6">
<h4 class="text-center"><small>STEP 2:</small> Choose your BOTTOM</h4>
<div id="bottom-carousel" class="carousel slide" data-ride="carousel">
<div class="carousel-inner">
<?php foreach ($products['lower'] as $index => $product): ?>
<div class="item <?php echo ($index == 0) ? 'active' : ''; ?>">
<img name="<?php echo $product['productID'] ?>" class="img-responsive center-block" src="<?php echo base_url();?>image/productimages/<?php echo $product['image'] ?>" style="margin: auto; height: 300px">
<div class="carousel-caption" style="padding: 10px; background-color: black; color: white;">
<?php echo $product['productname']; ?>
</div>
</div>
<?php endforeach ?>
</div>
<a class="left carousel-control" href="#bottom-carousel" role="button" data-slide="prev">
<i class="fa fa-lg fa-arrow-left" style="top: 45%; position: absolute; color: #000"></i>
</a>
<a class="right carousel-control" href="#bottom-carousel" role="button" data-slide="next">
<i class="fa fa-lg fa-arrow-right" style="top: 45%; position: absolute; color: #000"></i>
</a>
</div>
</div>
<div class="row">
<div class="col-md-offset-3 col-md-7" style="padding-top: 50px">
<h4 class="text-center"><small>STEP 3:</small> Submit</h4>
<button type="submit" form="hidden_form" class="btn btn-lg btn-block btn-primary">Go!</button>
</div>
</div>
</div>
</form>
<script>
$(document).ready(function() {
var index = $(this).find(".active").index();
// Stop those carousels from spinning
$('.carousel').carousel({
interval : false
});
// Let's figure out what the customer chose on the carousel
// and then put it on the hidden form
$('.carousel').on('slide',function(e){
var slideFrom = $(this).find('.active').index();
var slideTo = $(e.relatedTarget).index();
console.log(slideFrom+' => '+slideTo);
});
});
</script>
The simplest way to get the product_ID data is as below
<img class="img-responsive center-block" src="<?php echo base_url();?>image/productimages/<?php echo $product['image'] ?>" style="margin: auto; height: 300px">
<input type="hidden" value="<?php echo $product['productID'] ?>" name="data" />
Use an <input type="hidden" tag to get the value exactly.
I have a working carousel that contains a form and 3 images, I would like the carousel to be larger than it is (I thought if i didnt define the height and width it would be the size of the images but this hasnt worked), I want the form to appear in the center of the carousel, at the minute it is on the left, even though i have float:center i also experimented with padding but nothing seems to work. I have attached my code below, can anyone give me advice on 1) how to position the form to where i want within the carousel
2) how to make the carousel be the size of the images or larger than it is at the minute.
Any help would be much appreciated...
<style>
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
margin: auto;
}
</style>
</head>
<body>
<br>
<div id="myCarousel" class="carousel slide" data-ride="carousel" >
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
<li data-target="#myCarousel" data-slide-to="1"></li>
<li data-target="#myCarousel" data-slide-to="2"></li>
<li data-target="#myCarousel" data-slide-to="3"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<div class="span8" style="float:center; margin:0px, 0px, 0px, 20px;">
<form role="form" name="login" action="login.php" method="POST" style="align-center" >
Username<br><input type="text" name="Username" /></br>
Password<br><input type="password" name="Password" /></br>
<br><input type="submit" value="Login" name="login" />
<br>
<br>
<br>
</form>
</div>
</div>
<div class="item">
<img src="UUJ.jpg" alt="UUJ">
</div>
<div class="item">
<img src="UU2.jpg" alt="UU2">
</div>
<div class="item">
<img src="UU3.jpg" alt="UU3">
</div>
</div>
<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
To center the form you have to set width with margin-left: auto and margin-right: auto
<div class="span8" style="width: 500px; margin-right: auto; margin-left: auto;">
<!-- your form goes here -->
</div>
need help, i have here my code for my navbar with some php codes, one problem is the texts is aligning to the right . and i cant find the solution to this. i cant attach the css . ill attach it later after i post this . thanks a lot for those who can help me :)
<h1>HTML</h1>
<div class="container">
<nav class="navbar navbar-custom" role="navigation">
<div class="navbar-header">
<button type ="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<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="login_success.php"><img src="litrato/seal.png" HEIGHT="20" WIDTH="20" BORDER="0"></a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li >HOME </li>
<li class="active">CABECS </li>
<li>CON </li>
<li>COE </li>
<li>CASE </li>
<li>BED </li>
</ul>
<form class="navbar-form navbar-left" role="search" action='' method='post'>
<div class="form-group">
<input type="text" class="form-control" placeholder="Search" name='cisearch'>
</div>
<button class="btn btn-default glyphicon glyphicon-search" name='searchcabecs'></button>
</form>
<?php
include('connect.php');
if(isset($_POST['searchcabecs'])){
echo "<div style=' position:absolute; z-index:1; top:100%; left:21%; height:400%; width:50%; overflow: scroll; overflow-x: hidden; background-color:FFFFFF;'>";
echo"<table border=1 style='position:absolute; z-index:1; top:0%; left:0%; height:2%; width:100%; background-color:FFFFFF; border:2px solid yellow; border-radius: 3px; '>";
echo "<tr><td>RESULT :<button onclick=\"window.location.href='cabecs.php';\" style=' color:red; float:right;'>x</button></td></tr>";
$csearch = $_POST['cisearch'];
$search = mysql_query("SELECT * FROM addtopic where add_topic LIKE '%$csearch%' AND department = 'CABECS' ");
while($rows = mysql_fetch_array($search))
{
echo "<tr>";
echo "<form method='GET' id='view' action= 'view.php' >";
echo "<input type='hidden' name='supporttype' />";
echo "<td><div style='width:700px; height:100px; word-break: break-all; white-space: normal;'><p style='float:left;'></br>TOPIC: <input type='submit' value='$rows[add_topic]' style='background: #ffffff url(litrato/transparent.png); outline: FFFFFF; background-size: 60px auto; background-size: 100%; border:0; border: none; width:100%; height:100%;'>"."<input type='text' name='topic_id' value='$rows[topic_id]' hidden><input type='text' name='name' value='$name' hidden> <input type='text' name='addtopic' value='$rows[add_topic]' hidden>"."</a></p></div></td>";
echo "</form></tr>";
}
echo "</table></div>";
}
?>
<ul class="nav navbar-nav navbar-right">
<p class="navbar-text navbar-left">Signed in as <?php echo $name?></p>
<li>About Us </li>
<li class="dropdown">
<ul class="dropdown-menu" role="menu">
<li>View Profile</li>
<li>Edit Profile</li>
<li class="divider"></li>
<li>Log Out</li>
</ul>
</li>
</div>
</ul>
</div>
</nav>
</div>
Probably a text-align or float in the CSS