dropdown is not selecting selected option in php while editing - php

i'm selecting option while adding,but selected option is not in edit dropdown.What will be the issue?
Edit Appointment.php:
<?php
include_once 'config.php';
$id = $_REQUEST['id'];
$query="SELECT p.*,u.fileno FROM patients AS p,users AS u WHERE p.id_patient='$id' AND p.users_id_user=u.id_user";
$resultPatient=$db->select($query);
if(isset($_POST['requesttype'])&&$_POST['requesttype'] == 'editPatient'){
$updateInfo=array();
$updateInfo['name'] = $_REQUEST['name'];
$updateInfo['email'] = $_REQUEST['email'];
$updateInfo['age'] = $_REQUEST['age'];
/*$updateInfo['age'] = $_REQUEST['age'];
$updateInfo['gender'] = $_REQUEST['gender'];*/
$updateInfo['phone'] = str_replace(array('(',')',' ','-'), array('','','',''),$_REQUEST['phone']);
$updateInfo['date'] = date('d-m-Y', strtotime($_REQUEST['date']));
$updateInfo['time'] = $_REQUEST['time'];
$updateInfo['confirm_status'] = 'c';
$date=date('Y-m-d H:i:s');
$updateInfo['date_updated']=$date;
$updateCondition=" id_patient='".$id."'";
$res=$db->update('patients', $updateInfo,$updateCondition);
$id=$resultPatient[0]['users_id_user'];
$where="t.users_id_user='$id' AND";
$query="SELECT t.device_id,t.platforms_id_platform as id_platform FROM tokens as t WHERE $where t.device_id!=''";
$resultTokens=$db->select($query);
if($resultTokens)
{
include_once 'Gcm.php';
include_once 'Apns.php';
$deviceTokens=array();
$deviceTokens1=array();
$alert='Your appointment is confirmed on '.$updateInfo['date'].' at '.$updateInfo['time'];
foreach($resultTokens as $token)
{
if($token['id_platform']=='1'&&$token['device_id']!='')
$deviceTokens[]=$token['device_id'];
if($token['id_platform']=='2'&&$token['device_id']!='')
$deviceTokens1[]=$token['device_id'];
}
if(count($deviceTokens)>0)
{
$apns=new Apns();
$apns->apnsPush($deviceTokens,$alert);
}
if(count($deviceTokens1)>0)
{
$gcm = new GCM();
$message = array("m" => $alert);
$result = $gcm->send_notification($deviceTokens1,$message);
}
}
header("Location:appointments.php?m=u");
}
$querySlot = "SELECT * FROM slots";
$resultSlot=$db->select($querySlot);
$query="select * from photos where type='service'";
$resultUsers1=$db->select($query);
include_once 'header.php';
?>
<script type="text/javascript" src="js/jquery.timepicker.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery.timepicker.css" />
<script>
$(function() {
$('#basicExample').timepicker();
});
</script>
<!-- Sidebar begins -->
<div id="sidebar">
<!-- Left Main menu begins -->
<?php include_once 'menu.php'; ?>
<!-- Left Main menu ends -->
<!-- Secondary nav -->
<div class="secNav">
<div class="secWrapper">
<!--div class="secTop">
</div-->
<!-- Tabs container -->
<div id="tab-container" class="tab-container">
<div id="general">
<!-- Sidebar big buttons -->
<div id="general" style="display: block;" class="active">
<ul class="subNav">
<li><span class="icos-images2"></span>Add Appointment</li>
<li class="activeli"><span class="icos-images2"></span>View/Edit Appointments</li>
<li><span class="icos-images2"></span>Appointments History</li>
<li><span class="icos-images2"></span>View/Edit Reminder Settings</li>
<li><span class="icos-images2"></span>Add Reminder Settings</li>
<li><span class="icos-images2"></span>View/Edit Medicine Reminder Settings</li>
<li><span class="icos-images2"></span>Add Medicine Reminder Settings</li>
</ul>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<!-- Sidebar ends -->
<!-- Content begins -->
<div id="content">
<div class="contentTop">
<span class="pageTitle"><span class="icon-screen"></span>Edit Appointment</span>
<div class="clear"></div>
</div>
<!-- Breadcrumbs line -->
<div class="breadLine">
<div class="bc">
<ul id="breadcrumbs" class="breadcrumbs">
<li>Dashboard</li>
<li>Appointments</li>
<li class="current">Edit Appointment</li>
</ul>
</div>
</div>
<!-- Main content -->
<div class="wrapper">
<div class="fluid">
<form name="formEditAppointment" id="usualValidate" class="main" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">
<div class="widget grid6 chartWrapper" style="width:100%;min-height:550px;">
<div class="whead"><h6>Edit Appointment Information</h6><div class="clear"></div></div>
<div class="formRow">
<div class="grid3"><label>File No:<span class="req">*</span></label></div>
<div class="grid9"><?php echo stripslashes($resultPatient[0]['fileno']);?></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Name:<span class="req">*</span></label></div>
<div class="grid9"><input type="text" class="required" name="name" id="name" value="<?php echo stripslashes($resultPatient[0]['name']);?>"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Email:</label></div>
<div class="grid9"><input type="text" class="email" name="email" id="email" value="<?php echo stripslashes($resultPatient[0]['email']);?>"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Age:</label></div>
<div class="grid9"><input type="text" class="required" name="age" id="age" value="<?php echo stripslashes($resultPatient[0]['age']);?>"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Service:<span class="req">*</span></label></div>
<div class="grid9 searchDrop"><select data-placeholder="select service..." class="select" style="width: 100%" name="id_service">
<?php if($resultUsers1 && count($resultUsers1)>0)
foreach($resultUsers1 as $user)
{?>
<option value="<?php echo $user['id_photo']?>"<?php if($user['id_photo']==$user['title']) { ?> selected="selected" <?php } ?>><?php echo $user['title'];?></option>
<?php }?>
</select></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Phone:</label></div>
<div class="grid9"><input type="text" name="phone" id="phone" value="<?php echo stripslashes($resultPatient[0]['phone']);?>"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Date:</label></div>
<div class="grid9"><input type="text" class="required datepicker" name="date" id="date" value="<?php echo date('d-m-Y',strtotime($resultPatient[0]['date']));?>"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Time:</label></div>
<div class="grid9 searchDrop">
<input id="basicExample" type="text" name="time" class="time" value="<?php echo stripslashes($resultPatient[0]['time']);?>" style="width:80px"/>
</div>
<div class="clear"></div>
</div>
<input type="hidden" value="<?php echo $id; ?>" name="id" id="id_patient"/>
<input type="hidden" value="editPatient" name="requesttype"/>
<div class="formRow">
<div class="formSubmit">
<input class="buttonM bRed" id="next1" value="Save" type="submit">
<div class="clear"></div>
</div> <div class="clear"></div>
</div>
<div class="clear"></div></div>
</form>
</div>
</div>
<!-- Main content ends -->
</div>
<!-- Content ends -->
</body>
</html>
Add Appointment.php:
<?php
include_once 'config.php';
if(isset($_POST['requesttype'])&&$_POST['requesttype'] == 'addPatient'){
$insertInfo=array();
$insertInfo['users_id_user'] = $_REQUEST['id_user'];
$insertInfo['name'] = $_REQUEST['name'];
$insertInfo['email'] = $_REQUEST['email'];
$insertInfo['age'] = $_REQUEST['age'];
$insertInfo['gender'] = $_REQUEST['act'];
$insertInfo['service_id']=$_REQUEST['id_service'];
$insertInfo['phone'] = str_replace(array('(',')',' ','-'), array('','','',''),$_REQUEST['phone']);
$insertInfo['date'] = date('d-m-Y', strtotime($_REQUEST['date']));
$insertInfo['time'] = $_REQUEST['time'];
$insertInfo['confirm_status'] = 'c';
$date=date('Y-m-d H:i:s');
$insertInfo['date_created']=$date;
$insertInfo['date_updated']=$date;
$res=$db->insert('patients', $insertInfo);
$id=$_REQUEST['id_user'];
$where="t.users_id_user='$id' AND";
$query="SELECT t.device_id,t.platforms_id_platform as id_platform FROM tokens as t WHERE $where t.device_id!=''";
$resultTokens=$db->select($query);
if($resultTokens)
{
include_once 'Gcm.php';
include_once 'Apns.php';
$deviceTokens=array();
$deviceTokens1=array();
$alert='Your appointment is confirmed on '.$insertInfo['date'].' at '.$insertInfo['time'];
foreach($resultTokens as $token)
{
if($token['id_platform']=='1'&&$token['device_id']!='')
$deviceTokens[]=$token['device_id'];
if($token['id_platform']=='2'&&$token['device_id']!='')
$deviceTokens1[]=$token['device_id'];
}
if(count($deviceTokens)>0)
{
$apns=new Apns();
$apns->apnsPush($deviceTokens,$alert);
}
if(count($deviceTokens1)>0)
{
$gcm = new GCM();
$message = array("m" => $alert);
$result = $gcm->send_notification($deviceTokens1,$message);
}
}
header("Location:appointments.php?m=a");
}
$query="SELECT * FROM users";
$resultUsers=$db->select($query);
//$query="SELECT * FROM services";
$query="select * from photos where type='service'";
$resultUsers1=$db->select($query);
include_once 'header.php';
?>
<script type="text/javascript" src="js/jquery.timepicker.js"></script>
<link rel="stylesheet" type="text/css" href="js/jquery.timepicker.css" />
<script>
$(function() {
$('#basicExample').timepicker();
});
</script>
<!-- Sidebar begins -->
<div id="sidebar">
<!-- Left Main menu begins -->
<?php include_once 'menu.php'; ?>
<!-- Left Main menu ends -->
<!-- Secondary nav -->
<div class="secNav">
<div class="secWrapper">
<!--div class="secTop">
</div-->
<!-- Tabs container -->
<div id="tab-container" class="tab-container">
<div id="general">
<!-- Sidebar big buttons -->
<div id="general" style="display: block;" class="active">
<ul class="subNav">
<li class="activeli"><span class="icos-images2"></span>Add Appointment</li>
<li><span class="icos-images2"></span>View/Add Appointments</li>
<li><span class="icos-images2"></span>Appointments History</li>
<li><span class="icos-images2"></span>View/Add Reminder Settings</li>
<li><span class="icos-images2"></span>Add Reminder Settings</li>
<li><span class="icos-images2"></span>View/Add Medicine Reminder Settings</li>
<li><span class="icos-images2"></span>Add Medicine Reminder Settings</li>
</ul>
</div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<!-- Sidebar ends -->
<!-- Content begins -->
<div id="content">
<div class="contentTop">
<span class="pageTitle"><span class="icon-screen"></span>Add Appointment</span>
<div class="clear"></div>
</div>
<!-- Breadcrumbs line -->
<div class="breadLine">
<div class="bc">
<ul id="breadcrumbs" class="breadcrumbs">
<li>Dashboard</li>
<li>Appointments</li>
<li class="current">Add Appointment</li>
</ul>
</div>
</div>
<!-- Main content -->
<div class="wrapper">
<div class="fluid">
<form name="formAddAppointment" id="usualValidate" class="main" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" enctype="multipart/form-data">
<div class="widget grid6 chartWrapper" style="width:100%;min-height:680px;">
<div class="whead"><h6>Add Appointment Information</h6><div class="clear"></div></div>
<div class="formRow">
<div class="grid3"><label>File No:<span class="req">*</span></label></div>
<div class="grid9 searchDrop"><select data-placeholder="Choose a File No..." class="select" style="width: 100%" name="id_user">
<option value='0'>All</option>
<?php if($resultUsers && count($resultUsers)>0)
foreach($resultUsers as $user)
{?>
<option value="<?php echo $user['id_user']?>"><?php echo $user['fileno']?></option>
<?php }?>
</select></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Name:<span class="req">*</span></label></div>
<div class="grid9"><input type="text" class="required" name="name" id="name"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Email:</label></div>
<div class="grid9"><input type="text" class="email" name="email" id="email"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Age:</label></div>
<div class="grid9"><input type="text" class="required" name="age" id="age"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Sex:</label></div>
<div class="grid9 check"><label for="solve" class="mr20">Male:</label><input style="margin-top:5px;" type="radio" id="solve" name="act" value="m" class="required"/><label for="solve1" class="mr20">Female:</label><input style="margin-top:5px;" type="radio" id="solve1" name="act" value="f" /></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Service:<span class="req">*</span></label></div>
<div class="grid9 searchDrop"><select data-placeholder="select service..." class="select" style="width: 100%" name="id_service">
<option value='0'>All</option>
<?php if($resultUsers1 && count($resultUsers1)>0)
foreach($resultUsers1 as $user)
{?>
<option value="<?php echo $user['id_photo']?>"><?php echo $user['title']?></option>
<?php }?>
</select></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Phone:</label></div>
<div class="grid9"><input type="text" name="phone" id="phone" /></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Date:</label></div>
<div class="grid9"><input type="text" class="required datepicker" name="date" id="date" value="<?php echo date('d-m-Y',strtotime('now'));?>"/></div>
<div class="clear"></div>
</div>
<div class="formRow">
<div class="grid3"><label>Time:</label></div>
<div class="grid9 searchDrop">
<input id="basicExample" type="text" class="time" style="width:80px" name="time"/>
</div>
<div class="clear"></div>
</div>
<input type="hidden" value="addPatient" name="requesttype"/>
<div class="formRow">
<div class="formSubmit">
<input class="buttonM bRed" id="next1" value="Save" type="submit">
<div class="clear"></div>
</div> <div class="clear"></div>
</div>
<div class="clear"></div></div>
</form>
</div>
</div>
<!-- Main content ends -->
</div>
<!-- Content ends -->
</body>
</html>

Find this code <?php if($user['id_photo']==$user['title']) { ?>. You should check the database value with the option value when you edit. Replace with <?php if($user['id_photo']==$resultPatient[0]['id_photo']) { ?> and check.

Related

.php files working on localhost but not on webserver

I've created some kind of webshop for my highschool project. After building a filter system that searches through my database and loads them with the help of my self-written class product loader.
To set the filtervariables I've worked with $_GET. Everything is working perfectly fine on my localhost but when uploading to the server posed by my highschool only the header which I'm "requiring" separately works but anything else won't load.
Might it be that the server doesn't allow $_GET methods?
<?php
$current_page = 'Webshop.php';
require 'header.php';
require 'includes\productloader.inc.php';
?>
<body>
<form method="get"action="Webshop.php">
<aside class="EDside">
<div class="Filtersidebar">
<h1>Filter</h1>
<ul class="Filter">
<li><a>Max. Höhe</a></li>
<li><a>Max. Breite</a></li>
<li><a>Max. Tiefe</a></li>
<li><a>Metallart</a></li>
<li><a>Max. Preis</a></li>
<li><input type="text" name="Höhe" value=""></li>
<li><input type="text" name="Breite" value=""></li>
<li><input type="text" name="Tiefe" value=""></li>
<li><select id="Metallart" name="Metallart">
<option value=""></option>
<option value="Bronze">Bronze</option>
<option value="Messing">Messing</option>
<option value="Kupfer">Kupfer</option>
<option value="Edelstahl">Edelstahl</option>
<option value="Aluminium">Aluminium</option>
<option value="Rostig">Rostig</option>
</select></li>
<li><input type="text" name="Preis" value=""></li>
</ul>
</div>
<div>
<a href = Webshop.php><button>Zurücksetzen</button></a>
<button type ="submit" >Anwenden</button>
</div>
</aside>
</form>
<?php
if(isset($_GET['Höhe'])){
$maxhöhe;
if(!$_GET['Höhe']=="")
$maxhöhe = $_GET['Höhe'];
else
$maxhöhe = null;
if(!$_GET['Breite']=="")
$maxbreite = $_GET['Breite'];
else
$maxbreite = null;
if(!$_GET['Tiefe']=="")
$maxtiefe = $_GET['Tiefe'];
else
$maxtiefe = null;
$metallart;
if(!$_GET['Metallart']=="")
$metallart = $_GET['Metallart'];
else
$metallart = null;
$maxpreis;
if(!$_GET['Preis']=="")
$maxpreis = $_GET['Preis'];
else
$maxpreis = null;
if($maxhöhe == null && $maxbreite == null && $maxtiefe == null && $metallart == null && $maxpreis == null)
$loader = productloader::withoutstatement();
else
$loader = productloader::withstatement($maxhöhe,$maxbreite,$maxtiefe,$metallart,$maxpreis);
}
else
$loader = productloader::withoutstatement();
$productcount = count($loader->products);
?>
<?php
if($productcount>0){
echo '
<section class="EDSection">
<ul class="Skulptur">
<li> <div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[0]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[0]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[0]->preis.' EUR</p>
</div>
</div>
</div>
</li>
';
}
if($productcount>1){
echo '
<li><div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[1]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[1]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[1]->preis.' EUR</p>
</div>
</div>
</div>
</li>
';
}
if($productcount>2){
echo '
<li><div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[2]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[2]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[2]->preis.' EUR</p>
</div>
</div>
</div>
</li>
';
}
if($productcount>3){
echo '
<li><div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[3]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[3]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[3]->preis.' EUR</p>
</div>
</div>
</div>
</li>
';
}
if($productcount>4){
echo'
<li> <div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[4]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[4]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[4]->preis.' EUR</p>
</div>
</div>
</div>
</li>
';
}
if($productcount>5){
echo ' <li><div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[5]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[5]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[5]->preis.' EUR</p>
</div>
</div>
</div>
</li>';
}
if($productcount>6){
echo ' <li><div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[6]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[6]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[6]->preis.' EUR</p>
</div>
</div>
</div>
</li>';
}
if($productcount>7){
echo ' <li><div class = "SBox">
<div class="angebote">
<div class="angebot-bild">
<img class="a01" src="showimage.php?id='.$loader->products[7]->imgid.'" />
</div>
<div class="angebot-text">
<h1>'.$loader->products[7]->productname.'</h1>
</div>
<div class="angebot-preis">
<p>'.$loader->products[7]->preis.' EUR</p>
</div>
</div>
</div>
</li>';
}
?>
</section>
<section>
<div style="text-align: center">
<ul class="pagination">
<li>«</li>
<li><a class="active" href="Webshop.php">1</a></li>
<li>2</li>
<li>3</li>
<li>»</li>
</ul>
</div>
</section>
<?php
require 'footer.php';
?>
</body>
</html>

The footer of my website's homepage isn't coming

I have been trying to make a website. It is an online shopping website.
This is my code-
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Books And Beyond</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Bootstrap styles open source -->
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css" rel="stylesheet" crossorigin="anonymus">
<!-- Customize styles -->
<link href="style.css" rel="stylesheet"/>
<!-- font awesome styles open source -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" crossorigin="anonymus">
<!-- Favicons -->
<link rel="shortcut icon" href="/favicon.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style
type="text/css">
<!--
body {
background-image: url(assets/img/background.jpg);
}
-->
</style></head>
<body>
<!--
Upper Header Section
-->
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="topNav">
<div class="container">
<div class="alignR">
<?php if (isset($_SESSION['email'])) { echo $_SESSION['email']; } else { ?>
<ul class="nav pull-right">
<li class="dropdown">
<a data-toggle="dropdown" class="dropdown-toggle" href="#"><span class="icon-lock"></span> Login <b class="caret"></b></a>
<div class="dropdown-menu">
<form class="form-horizontal loginFrm" action="checkuser.php" method="post">
<div class="control-group">
<input name="email" type="text" class="span2" id="email" placeholder="Email">
</div>
<div class="control-group">
<input name="password" type="password" class="span2" id="password" placeholder="Password">
</div>
<div class="control-group">
<label class="checkbox">
<input type="checkbox"> Remember me
</label>
<button name="login" type="submit" class="shopBtn btn-block">Sign in</button>
</div>
</form>
</div>
</li>
</ul>
<?php } ?>
<?php if (isset($_SESSION['email'])) { ?>
Logout
<?php } else { ?>
<span class="icon-edit"></span> Register
<?php }?>
</div>
</div>
</div>
</div>
<!--
Lower Header Section
-->
<div class="container">
<div id="gototop"> </div>
<header id="header">
<div class="row">
<div class="span4">
<h1>
<a class="logo" href="index.php"><span>Books And Beyond</span>
<img src="assets/img/logo1.jpg" alt="" width="218" height="94"> </a> </h1>
</div>
</div>
</header>
<!--
Navigation Bar Section
-->
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<div class="nav-collapse">
<ul class="nav">
<li class="active">Home</li>
<li class="">About</li>
<li class="">Bargain Books</li>
<li class="">New Releases</li>
<li class="">Bestsellers</li>
<li class="">Contact Us</li>
</ul>
<ul class="nav pull-right">
</ul>
</div>
</div>
</div>
</div>
<div class="row">
<div class="span12">
<img src="assets/img/banner.jpg"/>
<hr class="soften"/>
</div>
</div>
<!--Body Section
-->
<div class="row">
<div id="sidebar" class="span3">
<div class="well well-small">
<h3> Category </h3>
<ul class="nav nav-list">
<li><span class="icon-chevron-right"></span>Fiction</li>
<li><span class="icon-chevron-right"></span>Non-Fiction</li>
<li><span class="icon-chevron-right"></span>Young Adult</li>
<li><span class="icon-chevron-right"></span>Children's</li>
<li><span class="icon-chevron-right"></span>Travel</li>
<li><span class="icon-chevron-right"></span>Education</li>
<li style="border:0"> </li>
</ul>
</div>
<!--<div class="well well-small alert alert-warning cntr">
<h2>50% Discount</h2>
<p>
only valid for online order. <br><br><a class="defaultBtn" href="#">Click here </a>
</p>
</div>-->
<!-- <div class="well well-small" ><img src="assets/img/paypal.jpg" alt="payment method paypal"></div>-->
<!--<a class="shopBtn btn-block" href="#">Upcoming products <br><small>Click to view</small></a>-->
<ul class="nav nav-list promowrapper">
<?php
/* require_once('dbconnect.php'); */
$result = mysql_query("SELECT * from product WHERE brand='accessories'");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
$price=$row["productprice"];
$productimage=$row["productimage"];
?>
<li>
<div class="thumbnail">
<img width="200" height="80" src="getImage.php?intproductid=<?php print $intproductid;?>" />
<div class="caption">
<table width="250" border="0">
<tr>
<td align="left" valign="middle"><form action="product_detail.php" method="post" name="form2" id="form2">
<label>
<input type="hidden" name="intproductid2" value="<?php echo $intproductid; ?>" />
<input name="Submit2" type="submit" class="shopBtn" value="View" />
</label>
</form></td>
<td align="right" valign="middle"><h4> <span class="pull-right"><?php echo $price; ?>.00</span></h4></td>
</tr>
</table>
</div>
</div>
</li>
<li style="border:0"> </li>
<?php } ?>
</ul>
</div>
<div class="span9">
<!--
New Products
-->
<div class="well well-small">
<h3>New Products </h3>
<hr class="soften"/>
<div class="row-fluid">
<div id="newProductcar" class="carousel slide">
<div class="">
<div class="item active">
<ul class="thumbnails">
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='bousni' LIMIT 1");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
//$productimage=$row["productimage"];
?>
<li class="span3">
<div class="thumbnail">
<img width="200" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
</div>
</li>
<?php } ?>
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='hela couture' LIMIT 1");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
//$productimage=$row["productimage"];
?>
<li class="span3">
<div class="thumbnail">
<img width="200" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
</div>
</li>
<?php } ?>
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='zey' LIMIT 1");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
//$productimage=$row["productimage"];
?>
<li class="span3">
<div class="thumbnail">
<img width="200" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
</div>
</li>
<?php } ?>
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='AL-JUMAIRA' LIMIT 1");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
//$productimage=$row["productimage"];
?>
<li class="span3">
<div class="thumbnail">
<img width="200" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="well well-small">
<div class="span8">
<div class="row-fluid">
<h3>Features Products </h3>
<hr class="soften"/>
<ul class="thumbnails">
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='roza' LIMIT 3");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
$productname=$row["productname"];
$brand=$row["brand"];
$price=$row["productprice"];
$productimage=$row["productimage"];
?>
<li class="span4">
<div class="thumbnail">
<img width="250" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
<div class="caption cntr">
<p style="color:#990033"><?php echo $productname; ?></p>
<p><?php echo $brand; ?></p>
<p><strong>SAR <?php echo $price; ?>.00</strong></p>
<div class="btn-group">
<form id="form2" name="form2" method="post" action="product_detail.php">
<label>
<input type="hidden" name="intproductid2" value="<?php echo $intproductid; ?>" />
<input name="Submit2" type="submit" class="shopBtn" value="View" />
<input name="Submit2" type="submit" class="defaultBtn" value="Add to cart" />
</label>
</form>
</div>
<br class="clr">
</div>
</div>
</li>
<?php } ?>
</ul>
<hr class="soften"/>
<ul class="thumbnails">
<?php
require_once('dbconnect.php');
$result = mysql_query("SELECT * from product WHERE brand='haya' LIMIT 3");
while ($row = mysql_fetch_array($result))
{
$intproductid=$row["id"];
$productname=$row["productname"];
$brand=$row["brand"];
$price=$row["productprice"];
$productimage=$row["productimage"];
?>
<li class="span4">
<div class="thumbnail">
<img width="250" height="120" src="getImage.php?intproductid=<?php print $intproductid;?>" />
<div class="caption cntr">
<p style="color:#990033"><?php echo $productname; ?></p>
<p><?php echo $brand; ?></p>
<p><strong>SAR <?php echo $price; ?>.00</strong></p>
<div class="btn-group">
<form id="form2" name="form2" method="post" action="product_detail.php">
<label>
<input type="hidden" name="intproductid2" value="<?php echo $intproductid; ?>" />
<input name="Submit2" type="submit" class="shopBtn" value="View" />
<input name="Submit2" type="submit" class="defaultBtn" value="Add to cart" />
</label>
</form>
</div>
<br class="clr">
</div>
</div>
</li>
<?php } ?>
</ul>
</div>
</div>
<div class="row">
</div>
</div>
</div></div></div>
<!--
Footer
-->
<footer class="footer" style="float: bottom;">
<div class="row-fluid">
<div class="span3">
<h5>ORDER SUPPORT</h5>
Store pickup<br>
Return and Refund<br>
</div>
<div class="span3">
<h5>PRODUCT SUPPORT</h5>
FAQs<br>
Inquiry<br>
</div>
<div class="span3">
<h5>COOPORATIVE INFO</h5>
Terms and Condition <br>
Contact us<br>
</div>
<div class="span3">
<h5>GET CONNECTED</h5>
About us <br>
Create Account<br>
</div>
</div>
</footer>
</div><!-- /container -->
<div class="copyright">
<div class="container">
<p class="pull-right"> </p>
<span>Copyright 2019, Fatimatuz Johura - s201403034- Jeddah (Ladies Branch);<br> Books And Beyond</span>
</div>
</div>
<script src="assets/js/jquery.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/jquery.easing-1.3.min.js"></script>
<script src="assets/js/jquery.scrollTo-1.4.3.1-min.js"></script>
<script src="assets/js/shop.js"></script>
</body>
</html>
The 'New Products' and the footer section is not coming and I cant figure out why. I dont have a webhost yet so I am using localhost for now. I have tried editing the code but whatever I do, it does not seem to work. If anyone can help, I would really appreciate it. Thank you.
On line 152 (new products is on line ~ 185[ish])
/* require_once('dbconnect.php'); */
$result = mysql_query("SELECT * from product WHERE brand='accessories'");
As I said in the comments you use this require_once('dbconnect.php'); multiple times when it should be only once at the top of your file.
The above code is the first occurrence I could find, and as it's commented out, that query is going to bomb out on you. Execution happens top to bottom and the first uncommitted occurrence of that is line 196[ish], which is way to late for that first query.
Also as I said in the comments
Try turning on Error reporting - error_reporting(-1); and ini_set('display_errors', '1'); put those right after the <?php tag
You can save yourself, and us a lot of time that way.
So in Summery,
Remove all of these require_once('dbconnect.php'); and then add just one after the opening <?php tag.
PS you can easily test this, by just commenting that first query out, or by uncommenting that first require_once.

Unable to connect phpMyAdmin database to my website

I am having trouble connecting a database i have created in phpMyAdmin to my web page using PHP. I am pretty sure my code is correct in both the html and php files and my DB and table names are correct, but when i try to use the registration form, it does nothing. I am using jQuery mobile, so have tried it with and without the data-ajax="false" attribute to no avail. What am i missing here? Thanks for any answers :) I have included the relevant html and php code below, it is the register form in the register page I am trying to connect to the DB.
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1; minimum-scale=1;">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
<link href="/projects/ibill_v3/css/mainstyles.css" rel="StyleSheet"/>
<link href="/projects/ibill_v3/css/register.css" rel="StyleSheet"/>
<link href="/projects/ibill_v3/css/login.css" rel="StyleSheet"/>
<link href="/projects/ibill_v3/css/home.css" rel="StyleSheet"/>
<link href="/projects/ibill_v3/css/record_session.css" rel="StyleSheet"/>
<link href="/projects/ibill_v3/css/viewsessions.css" rel="StyleSheet"/>
<link href="/projects/ibill_v3/css/email.css" rel="StyleSheet"/>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script src="script.js"></script>
<script type='text/javascript' src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<script type='text/javascript'>
$(document).on('pageinit', function(){
$('#registerForm').validate({ // initialize the plugin
// rules & options
});
});
</script>
<script type='text/javascript'>
$(document).on('pageinit', function(){
$('.loginform').validate({ // initialize the plugin
// rules & options
});
});
</script>
</head>
<body>
<!--********************************REGISTER PAGE**********************************************-->
<!--****************************************************************************************-->
<!--********************************HEADER**********************************************-->
<div data-role="page" id="register">
<div data-role="header" data-id="foo1" data-position="fixed">
<div class='cssmenu'>
<ul>
<li class='active'><a href='#home'>Home</a></li>
<li><a href='#sessionrecord'>Record a Session</a></li>
<li><a href='#viewsessions'>View Sessions</a></li>
<li><a href='#email'>E-mail an Invoice</a></li>
</ul>
</div>
</div>
<!--********************************HEADER**********************************************-->
<!--********************************MAIN**********************************************-->
<div data-role="main" class="ui-content">
<img class="mainlogo" src="/projects/ibill_v3/img/ibill logo.png" alt="iBill Logo" width="250" height="190">
<section class="registerform">
<h1>The iBill Invoicing App for Activity Instructors</h1>
<p>Register below</p>
<form data-ajax="false" method="POST" action="register.php" >
<ul>
<li>
<label for="username">Username</label>
<input type="text" name="username" id="username" class="required" minlength="5" placeholder="enter username (min-5 characters)">
</li>
<li>
<label for="firstname">Firstname</label>
<input type="text" name="firstname" id="firstname" class="required" minlength="5" placeholder="enter firstname">
</li>
<li>
<label for="username">Surname</label>
<input type="text" name="surname" id="surname" class="required" minlength="5" placeholder="enter surname">
</li>
<li>
<label for="email">Email</label>
<input type="email" name="email" id="email" class="required email" placeholder="yourname#email.com">
</li>
<li>
<label for="password">Password</label>
<input type="password" name="password" id="password" class="required" minlength="6" placeholder="enter password">
</li>
<li>
<label for="confirmpassword">Confirm Password</label>
<input type="password" name="confirmpassword" id="confirmpassword" class="required" minlength="6" placeholder="re-enter password">
</li>
<div id="registerbutton">
<input type="submit" value="Register">
</div>
</ul>
</form>
</section>
</div>
<!--********************************MAIN**********************************************-->
<!--********************************FOOTER**********************************************-->
<div data-role="footer">
<footer class="footer">
<p>awilliams©</p>
</footer>
</div>
</div>
<!--********************************REGISTER PAGE**********************************************-->
<!--****************************************************************************************-->
<!--********************************LOGIN PAGE**********************************************-->
<!--****************************************************************************************-->
<!--********************************HEADER**********************************************-->
<div data-role="page" id="login">
<div data-role="header" data-id="foo1" data-position="fixed">
<div class='cssmenu'>
<ul>
<li class='active'><a href='#home'>Home</a></li>
<li><a href='#sessionrecord'>Record a Session</a></li>
<li><a href='#viewsessions'>View Sessions</a></li>
<li><a href='#email'>E-mail an Invoice</a></li>
</ul>
</div>
</div>
<!--********************************HEADER**********************************************-->
<!--********************************MAIN**********************************************-->
<div data-role="main" class="ui-content">
<img class="mainlogo" src="/projects/ibill_v3/img/ibill logo.png" alt="iBill Logo" width="250" height="190">
<section class="loginform">
<form action="form.php" method="post">
<ul>
<li><label for="usermail">Email</label>
<input type="email" name="usermail" placeholder="yourname#email.com" class="required"></li>
<li><label for="password">Password</label>
<input type="password" name="password" placeholder="enter password" minlength="6"></li>
<li>
<div id="loginbutton">
<input type="submit" value="Login"></li>
</div>
<div id="registerbutton">
<input type="submit" value="Register"></li>
</div>
</ul>
</form>
</section>
</div>
<!--********************************MAIN**********************************************-->
<!--********************************FOOTER**********************************************-->
<div data-role="footer">
<footer class="footer">
<p>awilliams©</p>
</footer>
</div>
</div>
<!--********************************LOGIN PAGE**********************************************-->
<!--****************************************************************************************-->
<!--********************************HOME PAGE**********************************************-->
<!--***************************************************************************************-->
<!--********************************HEADER**********************************************-->
<div data-role="page" id="home">
<div data-role="header" data-id="foo1" data-position="fixed">
<div class='cssmenu'>
<ul>
<li class='active'><a href='#home'>Home</a></li>
<li><a href='#sessionrecord'>Record a Session</a></li>
<li><a href='#viewsessions'>View Sessions</a></li>
<li><a href='#email'>E-mail an Invoice</a></li>
</ul>
</div>
</div><!-- /header -->
<!--********************************HEADER**********************************************-->
<!--********************************MAIN**********************************************-->
<div data-role="main" class="ui-content">
<img class="mainlogo" src="/projects/ibill_v3/img/ibill logo.png" alt="iBill Logo" width="250" height="190">
<section class="maincontent">
<h1>The iBill Invoicing App for Activity Instructors</h1>
<p>iBill is a cross-platform app that allows you track and manage activity sessions on the go.</p>
<br>
<p>Record an activity session to get started!</p>
<div style="text-align:center">
Record a Session
</div>
</section>
</div>
<!--********************************MAIN**********************************************-->
<!--********************************FOOTER**********************************************-->
<div data-role="footer">
<footer class="footer">
<p>awilliams©</p>
</footer>
</div>
</div>
<!--********************************FOOTER**********************************************-->
<!--********************************HOME PAGE**********************************************-->
<!--***************************************************************************************-->
<!--********************************RECORD SESSION PAGE************************************-->
<!--***************************************************************************************-->
<!--********************************HEADER**********************************************-->
<div data-role="page" id="sessionrecord">
<div data-role="header" data-id="foo1" data-position="fixed">
<div class='cssmenu'>
<ul>
<li class='active'><a href='#home'>Home</a></li>
<li><a href='#sessionrecord'>Record a Session</a></li>
<li><a href='#viewsessions'>View Sessions</a></li>
<li><a href='#email'>E-mail an Invoice</a></li>
</ul>
</div>
</div><!-- /header -->
<!--********************************HEADER**********************************************-->
<!--********************************MAIN**********************************************-->
<div data-role="main" class="ui-content">
<img class="mainlogo" src="/projects/ibill_v3/img/ibill logo.png" alt="iBill Logo" width="250" height="190">
<section class="maincontent">
<h1>Record a session using the form below</h1>
<form method="post" action="" id="sessionRecord">
<fieldset>
<select name="typeofactivity" id="typeofactivity" data-native-menu="false">
<option>Type of Session</option>
<option value="surf">Surf</option>
<option value="coast">Coasteer</option>
<option value="bodyboard">Bodyboard</option>
<option value="climbing">Cornish Challenge</option>
</select>
</fieldset>
<fieldset>
<select name="employer" id="employer" data-native-menu="false">
<option>Employer</option>
<option value="nac">Newquay Activity Centre</option>
<option value="coastline">Coastline Coasteer</option>
</select>
</fieldset>
<form method="post" action="PHP HERE!">
<label for="datetime">Date and Time of Session</label>
<input type="datetime-local" data-clear-btn="false" name="datetime" id="datetime" value="">
</form>
<form method="post" action="PHP HERE!">
<label for="amount">Amount (GBP)</label>
<input type="number" data-clear-btn="true" name="amount" id="amount" value="">
</form>
<div id="submitbutton">
<input type="submit" value="Submit">
</div>
</form>
</section>
</div>
<!--********************************MAIN**********************************************-->
<!--********************************FOOTER**********************************************-->
<div data-role="footer">
<footer class="footer">
<p>awilliams©</p>
</footer>
</div>
</div>
<!--********************************FOOTER**********************************************-->
<!--********************************RECORD SESSION PAGE************************************-->
<!--***************************************************************************************-->
<!--********************************VIEW SESSIONS PAGE************************************-->
<!--***************************************************************************************-->
<!--********************************HEADER**********************************************-->
<div data-role="page" id="viewsessions">
<div data-role="header" data-id="foo1" data-position="fixed">
<div class='cssmenu'>
<ul>
<li class='active'><a href='#home'>Home</a></li>
<li><a href='#sessionrecord'>Record a Session</a></li>
<li><a href='#viewsessions'>View Sessions</a></li>
<li><a href='#email'>E-mail an Invoice</a></li>
</ul>
</div>
</div><!-- /header -->
<!--********************************HEADER**********************************************-->
<!--********************************MAIN**********************************************-->
<div data-role="main" class="ui-content">
<img class="mainlogo" src="/projects/ibill_v3/img/ibill logo.png" alt="iBill Logo" width="250" height="190">
<section class="maincontent">
<!--MAIN CONTENT GOES HERE-->
</section>
</div>
<!--********************************MAIN**********************************************-->
<!--********************************FOOTER**********************************************-->
<div data-role="footer">
<footer class="footer">
<p>awilliams©</p>
</footer>
</div>
</div>
<!--********************************FOOTER**********************************************-->
<!--********************************VIEW SESSIONS PAGE************************************-->
<!--***************************************************************************************-->
<!--********************************EMAIL AN INVOICE PAGE************************************-->
<!--***************************************************************************************-->
<!--********************************HEADER**********************************************-->
<div data-role="page" id="email">
<div data-role="header" data-id="foo1" data-position="fixed">
<div class='cssmenu'>
<ul>
<li class='active'><a href='#home'>Home</a></li>
<li><a href='#sessionrecord'>Record a Session</a></li>
<li><a href='#viewsessions'>View Sessions</a></li>
<li><a href='#email'>E-mail an Invoice</a></li>
</ul>
</div>
</div><!-- /header -->
<!--********************************HEADER**********************************************-->
<!--********************************MAIN**********************************************-->
<div data-role="main" class="ui-content">
<img class="mainlogo" src="/projects/ibill_v3/img/ibill logo.png" alt="iBill Logo" width="250" height="190">
<section class="maincontent">
<!--MAIN CONTENT GOES HERE-->
</section>
</div>
<!--********************************MAIN**********************************************-->
<!--********************************FOOTER**********************************************-->
<div data-role="footer">
<footer class="footer">
<p>awilliams©</p>
</footer>
</div>
</div>
<!--********************************FOOTER**********************************************-->
<!--********************************EMAIL AN INVOICE PAGE************************************-->
<!--***************************************************************************************-->
</body>
<?php
$servername = "localhost";
$username = "root";
$password = "cornwall";
$con=mysqli_connect('localhost','root','cornwall','ibill');
// This code creates a connec'tion to the MySQL database in PHPMyAdmin named 'ibill':
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
// The connection is then checked, if it fails, an echo is sent back to the page stating a connection error.
$username = $_POST['username'];
$firstname = $_POST['firstname'];
$surname = $_POST['surname'];
$emailaddress = $_POST['emailaddress'];
$password = $_POST['password'];
$confirmpassword = $_POST['confirmpassword'];
//These are the different PHP variables that store my posted data.
$register="INSERT INTO user_details (username, firstname, surname, emailaddress, password,) VALUES ('$username', '$firstname', '$surname', '$emailaddress', '$password')";
echo $register;
$result=mysqli_query($con, $register);
//This is the query that will be sent to the MySQL server.
header('Location: http://localhost/projects/ibill_v3/html/main.html#login');
exit();
//This directs the user to the relevant page after successful registration.
?>
First of all, read this article about SQL injection: How can I prevent SQL injection in PHP?.
There is an error in you SQL query. In your PHP file, replace this line:
$result=mysqli_query($con, $register);
with this:
if(mysqli_query($con,$register) === FALSE){
echo mysqli_error($con);
}
To display errors in PHP code, add these lines:
/** Error reporting */
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
Ref: How do I get PHP errors to display?

Website repeating in a loop after PHP is applied for data retrieval

well I probably ran into a problem this morning and trying to figure out where I'm going wrong. The page was working fine without the PHP but as soon as I stuffed this page with statements from PHP (For displaying data in my website) I observed that my website was repeating with the number of records. Say, 5 records are to be displayed in the website then the website repeats 5 times. I'm using MySQL, PHPmyAdmin and HTML. Any help would be greatly appreciated and I hope I'm not missing out on something very usual. Before looking at the code I would recommend you to just go through the PHP part because before adding PHP, the site was functioning very normally!
Here's all you will need: My HTML code for the particular page:
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
session_start();
if (!(isset($_SESSION['state']) && $_SESSION['state'] != '')) {
header ("Location: ../login.php");
}
else
{
include_once ('E:/Softwares/wamp/www/connection.php');
$username = $_SESSION['username'];
$result = mysql_query("SELECT *from `movie_schedule`");
if(mysql_num_rows($result))
{while($row = mysql_fetch_array($result, MYSQL_BOTH))
{
?>
<!DOCTYPE html>
<html>
<head>
<title>The CineShed Cinemas</title>
<link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
<link href="css/bootstrap1.css" rel="stylesheet" type="text/css" media="all">
<!-- web-font -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,300,700,800,400,600' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Poiret+One' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Merriweather:400,700italic,400italic,300,900,700,900italic,300italic' rel='stylesheet' type='text/css'>
<!-- web-font -->
<!-- js -->
<script src="js/jquery.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
<!-- js -->
<!-- start-smoth-scrolling -->
<script type="text/javascript" src="js/move-top.js"></script>
<script type="text/javascript" src="js/easing.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$(".scroll").click(function(event){
event.preventDefault();
$('html,body').animate({scrollTop:$(this.hash).offset().top},1000);
});
});
</script>
<!-- start-smoth-scrolling -->
</head>
<body>
<!-- header -->
<div id="home" class="header">
<!-- container -->
<div class="container">
<div class="header-logo">
<h1>The CineShed<span> Cinemas<br>-------------------------------<br>You've logged in as ADMIN</span></h1>
</div>
<div class="top-nav">
<p><a class="Signup play-icon popup-with-zoom-anim" href="#small-dialog3"></a><span> Log Out</P>
</div>
<div class="clearfix"> </div>
<!-- banner Slider starts Here -->
<script src="js/responsiveslides.min.js"></script>
<script>
// You can also use "$(window).load(function() {"
$(function () {
// Slideshow 4
$("#slider4").responsiveSlides({
auto: true,
pager: true,
nav: false,
speed: 500,
namespace: "callbacks",
before: function () {
$('.events').append("<li>before event fired.</li>");
},
after: function () {
$('.events').append("<li>after event fired.</li>");
}
});
});
</script>
<!--//End-slider-script -->
<div id="top" class="callbacks_container">
<ul class="rslides" id="slider4">
<li>
<div class="header-info">
<p>BY<span> ZARYAB</span><span class="sub-text"> Ali</span></p>
<p>Experience the</p>
<p> third dimension!</p>
<div class="red">DOLBY DIGITAL 3-D</div>
<!--
<div class="button">View Here</div>
-->
</div>
</li>
<li>
<div class="header-info">
<p>BY<span> ZARYAB</span><span class="sub-text"> Ali</span></p>
<p>Premium Seating?</p>
<p> We've got this covered!</p>
<div class="red">TITAN XC</div>
</div>
</li>
<li>
<div class="header-info">
<p>BY<span> ZARYAB</span><span class="sub-text"> Ali</span></p>
<p>Enjoy the awesomeness</p>
<p> of explosive sound!</p>
<div class="red">WITH 7.1 AUDIO CHANNELS!</div>
</div>
</li>
<li>
<div class="header-info">
<p>BY<span> ZARYAB</span><span class="sub-text"> Ali</span></p>
<p>Activities to keep</p>
<p> your wee ones busy!</p>
<div class="red">KID'S CORNER</div>
</div>
</li>
<li>
<div class="header-info">
<p>BY<span> ZARYAB</span><span class="sub-text"> Ali</span></p>
<p>A mouth-watering</p>
<p> menu awaits you!</p>
<div class="red"># Arizona Grill</div>
</div>
</li>
</ul>
<div class="clearfix"> </div>
<!-- banner Slider Ends Here -->
</div>
</div>
<!-- container -->
</div>
<!-- header -->
<!-- sticky -->
<div class="sticky">
<!-- container -->
<div class="container">
<div class="top-header">
<div class="fixed-header">
<div class="sticky-logo">
<h1><a class="scroll" href="#home">The CineShed <span>Cinemas</a> </span></h1>
</div>
<div class="sticky-nav">
<ul>
<li><a class="scroll active" href="#banner">View Trailers</a></li>
<li><a class="scroll" href="#manage">Manage Show Times</a></li>
<li><a class="scroll" href="#offpur">View Purchases</a></li>
</ul>
</div>
<div class="clearfix"> </div>
</div>
</div>
</div>
<!-- container -->
</div>
<!-- sticky -->
<!-- script-for sticky-nav -->
<script>
$(document).ready(function() {
var navoffeset=$(".top-header").offset().top;
$(window).scroll(function(){
var scrollpos=$(window).scrollTop();
if(scrollpos >=navoffeset){
$(".top-header").addClass("fixed");
}else{
$(".top-header").removeClass("fixed");
}
});
});
</script>
<!-- /script-for sticky-nav -->
<!-- banner -->
<div id="banner" class="banner">
<a class="play-icon popup-with-zoom-anim" href="#small-dialog"><span> </span></a>
<!-- pop-up-box -->
<script type="text/javascript" src="js/modernizr.custom.min.js"></script>
<link href="css/popuo-box.css" rel="stylesheet" type="text/css" media="all" />
<script src="js/jquery.magnific-popup.js" type="text/javascript"></script>
<!--//pop-up-box-->
<div id="small-dialog" class="mfp-hide">
<iframe src="https://www.ytpak.com/?component=video&task=embed&id=R-XsppzuH-k&branding=no" scrolling="NO" frameborder="0" width="100%" height="315" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<iframe src="https://www.ytpak.com/?component=video&task=embed&id=K-H35Mpj4uk&branding=no" scrolling="NO" frameborder="0" width="100%" height="315" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
<iframe src="https://www.ytpak.com/?component=video&task=embed&id=K-H35Mpj4uk&branding=no" scrolling="NO" frameborder="0" width="100%" height="315" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
</div>
<div id="small-dialog3" class="mfp-hide">
<div class="login">
<h3>Login</h3>
<p>Enter your account details to login</p>
<input type="text" maxlength="20" value="EMAIL" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'EMAIL';}">
<input type="text" maxlength="10" value="PASSWORD" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'PASSWORD';}">
<input type="submit" value="Submit"/>
</div>
</div>
<div id="small-dialog2" class="mfp-hide">
<div class="signup">
<h3>Register</h3>
<h4>Please Enter Your Details</h4>
<input type="text" value="First Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'First Name';}" />
<input type="text" value="Second Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Second Name';}" />
<input type="text" class="email" value="Email" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Email';}" />
<input type="text" class="password" value="Password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Password';}"/>
<input type="text" class="email" value="Confirm password" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Confirm password';}" />
<input type="submit" value="Submit"/>
</div>
</div>
<script>
$(document).ready(function() {
$('.popup-with-zoom-anim').magnificPopup({
type: 'inline',
fixedContentPos: false,
fixedBgPos: true,
overflowY: 'auto',
closeBtnInside: true,
preloader: false,
midClick: true,
removalDelay: 300,
mainClass: 'my-mfp-zoom-in'
});
});
</script>
</div>
<!-- banner -->
<!-- container -->
<div id="manage" class="container">
<h3><br>Manage Show Times<br></h3>
<div class="col-md-7">
<div class="col-md-6">
<form method="post" action="savemovie.php">
<input type="text" class="text" value="Movie ID" name="field1" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Movie ID';}">
<input type="text" class="text" value="Movie Date" name="field2" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Movie Date';}">
<input type="text" class="text" value="Show Time" name="field3" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Show Time';}">
<input type="text" class="text" value="Movie Cost" name="field4" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Movie Cost';}">
<input type="text" class="text" value="Movie Name" name="field5" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Movie Name';}">
<input type="text" class="text" value="Tickets Availability" name="field6" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Tickets Availability';}">
<div class="clearfix"> </div>
<div class="submit-button">
<input type="submit" value="ADD MOVIE">
</form>
</div>
</div>
<div class="clearfix"> </div>
</div>
</div>
<!-- container -->
<?php
$result1 = mysql_query("SELECT *from `movie_schedule`");
if(mysql_num_rows($result1))
{while($row2 = mysql_fetch_array($result1, MYSQL_BOTH))
{
?>
<!-- content-events -->
<div id="event" class="content-event">
<!-- container -->
<div class="container">
<h3>Show Times</h3>
<div class="event-grids">
<div class="col-md-3 event-grid">
<div class="pic"> </div>
<ul>
<li class="hedding"><?php print($row2['Movie_ID']); ?> <?php print($row2['Movie_Name']); ?></li>
<li class="date"><?php print($row2['Movie_Date']); ?></li>
</ul>
<div class="clearfix"> </div>
</div>
<div class="col-md-4 event-grid small-text">
<p><br><?php print($row2['Show_Time']); ?></p>
</div>
<div class="col-md-2 event-grid large-text">
<p class="text"><?php print($row2['Movie_Cost']); ?></p>
</div>
<div class="col-md-3 event-grid text-button">
<ul>
<li class="num"><?php print($row2['Movie_ID']); ?></li>
<li class="button yellow">Remove</li>
</ul>
<?php
}}
?>
</div>
</div>
<!-- container -->
</div>
<!-- contact-events -->
<!-- content-events -->
<div id="offpur" class="content-event">
<!-- container -->
<div class="container">
<h3>View Offline Purchases</h3>
<div class="event-grids">
<div class="col-md-3 event-grid">
<div> </div>
<ul>
<li class="hedding">Offline Purchase ID</li>
<li class="date">(Serial Number)</li>
</ul>
<div class="clearfix"> </div>
</div>
<div class="col-md-4 event-grid small-text">
<p><br>Movie ID</p>
</div>
<div class="col-md-2 event-grid large-text">
<p class="text">Amount</p>
</div>
<div class="col-md-3 event-grid text-button">
<ul>
<li class="num">Quantity Of Tickets</li>
</ul>
</div>
<div class="clearfix"> </div>
</div>
<div class="event-grids">
<div class="col-md-3 event-grid">
<div> </div>
<ul>
<li class="hedding">111</li>
<li class="date"></li>
</ul>
<div class="clearfix"> </div>
</div>
<div class="col-md-4 event-grid small-text">
<p>01</p>
</div>
<div class="col-md-2 event-grid large-text">
<p class="text">2100 PKR</p>
</div>
<div class="col-md-3 event-grid text-button">
<ul>
<li class="num">3</li>
</ul>
</div>
<div class="clearfix"> </div>
</div>
<div class="event-grids">
<div class="col-md-3 event-grid">
<div> </div>
<ul>
<li class="hedding">112</li>
<li class="date"></li>
</ul>
<div class="clearfix"> </div>
</div>
<div class="col-md-4 event-grid small-text">
<p><br>03</p>
</div>
<div class="col-md-2 event-grid large-text">
<p class="text">1400 PKR</p>
</div>
<div class="col-md-3 event-grid text-button">
<ul>
<li class="num">2</li>
</ul>
</div>
<div class="clearfix"> </div>
</div>
<div class="event-grids">
<div class="col-md-3 event-grid">
<div> </div>
<ul>
<li class="hedding">115</li>
<li class="date"></li>
</ul>
<div class="clearfix"> </div>
</div>
<div class="col-md-4 event-grid small-text">
<p><br>02</p>
</div>
<div class="col-md-2 event-grid large-text">
<p class="text">3500 PKR</p>
</div>
<div class="col-md-3 event-grid text-button">
<ul>
<li class="num">5</li>
</ul>
</div>
<div class="clearfix"> </div>
</div>
<div class="event-grids">
<div class="col-md-3 event-grid">
<div> </div>
<ul>
<li class="hedding">124</li>
<li class="date"></li>
</ul>
<div class="clearfix"> </div>
</div>
<div class="col-md-4 event-grid small-text">
<p><br>02</p>
</div>
<div class="col-md-2 event-grid large-text">
<p class="text">2800 PKR</p>
</div>
<div class="col-md-3 event-grid text-button">
<ul>
<li class="num">4</li>
</ul>
</div>
<div class="clearfix"> </div>
</div>
</div>
<!-- container -->
</div>
<!-- contact-events -->
<!-- portfolio -->
<div class="portfolio">
<!-- container -->
<div class="container">
<h3>Gallery</h3>
<div class="gallery-images">
<div class="gallery-image">
<img src="images/3.jpg" alt="" />
<div>
<span> </span>
</div>
</div>
<div class="gallery-image">
<img src="images/4.jpg" alt="" />
<div>
<span> </span>
</div>
</div>
<div class="gallery-image right">
<img src="images/5.jpg" alt="" />
<div>
<span> </span>
</div>
</div>
<div class="gallery-image">
<img src="images/7.jpg" alt="" />
<div>
<span> </span>
</div>
</div>
<div class="gallery-image">
<img src="images/6.jpg" alt="" />
<div>
<span> </span>
</div>
</div>
<div class="gallery-image right">
<img src="images/8.jpg" alt="" />
<div>
<span> </span>
</div>
</div>
<div class="clearfix"> </div>
<div class="gallery-text">
</div>
</div>
</div>
<!-- container -->
</div>
<!-- portfolio -->
<!-- contact -->
<div id="contact" class="contact">
<!-- container -->
<div class="container">
<h3>Contact Us</h3>
<div class="col-md-7">
<div class="col-md-6">
<form>
<input type="text" class="text" value="Name" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Name';}">
<input type="text" class="text" value="Email" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Email';}">
</form>
</div>
<div class="col-md-6">
<form>
<textarea value="Message:" onfocus="if(this.value == 'Message') this.value='';" onblur="if(this.value == '') this.value='Message';">Message</textarea>
</form>
</div>
<div class="clearfix"> </div>
<div class="submit-button">
<form>
<input type="submit" value="SEND">
</form>
</div>
</div>
<div class="col-md-5">
<ul>
<li> </li>
<li> </li>
<li> </li>
</ul>
</div>
<div class="clearfix"> </div>
</div>
<!-- container -->
</div>
<!-- contact -->
<div class="border-bottom"> </div>
<!-- footer -->
<div class="footer">
<div class="copyright">
<p>
Designed By : Zaryab Ali (07410)
</p>
</div>
</div>
<!-- footer -->
<script type="text/javascript">
$(document).ready(function() {
/*
var defaults = {
containerID: 'toTop', // fading element id
containerHoverID: 'toTopHover', // fading element hover id
scrollSpeed: 1200,
easingType: 'linear'
};
*/
$().UItoTop({ easingType: 'easeOutQuart' });
});
</script>
<span id="toTopHover" style="opacity: 1;"> </span>
<!-- content-Get-in-touch -->
<?php
}}}
?>
</body>
</html>
You are creating the HEAD and BODY of you page in the loop that returns results from your database.This loop should be further in your page, where you are displaying the actual results, and should show only those results.

php & html form alignment problems

I want to add a simple form above my right side bar, however the php is miss aligning the form and squashing the form itself picture
I simply want the table to display within the confines of the rest of the side bar, yet I can't seem to figure it out no matter what I do, below is the code for the page, I know there should be a simple solution, but I can't see it.
<body>
<include file="Common:tracking" />
<include file="Common:header" />
<div class="container">
<div class="section">
<div class="wrapshow">
<div class="body">
<div class="article-list">
<ul>
<volist name="blog_list" id="item">
<li>
<div class="head">
<a href="{$item.href}"
class="btn_view_detail"
><img src="{$item.url_picture}" alt="{$item.title}" title="{$item.title}" /></a>
</div><!-- end head -->
<div class="body">
<h3>
<a href="{$item.href}"
class="btn_view_detail" >{$item.title}</a>
</h3>
<div class="tag">
<!--
Blogging
|
Leave a comment
!-->
</div><!-- end tag -->
<div class="con">
{$item.content}
</div><!-- end con -->
<div class="bar">
<a href="{$item.href}"
class="link btn_view_detail">Details<i class="iconfont icon-arrows-right-bottom"></i></a>
<a href="{$item.href}"
class="date btn_view_detail">{$item.dateline_post|date='m/d/Y',###}</a>
</div><!-- end bar -->
</div><!-- end body -->
</li>
</volist>
</ul>
</div><!-- end article-list -->
<div class="paging">
{$page}
</div><!-- end paging -->
</div><!-- end body -->
<div class="site">
<div class="section">
<div class="serve-apply">
<div class="body">
<ul>
<volist name="index_mid4" id="item">
<li>
<h4>{$item.title}</h4>
{$item.content}
<i class="{$item.title_sub}"></i>
</li>
</volist>
</ul>
</div><!-- end body -->
<div class="side shake-an">
<form action="{:U('Contact/quickAdd')}" class="frm_contact">
<input type="hidden" name="type" value="1" />
<h3>Request <em>FREE</em> Trial</h3>
<div class="form-element">
<input type="text" class="form-text blue" name="customer_name" id="username" placeholder="Full Name" />
<label for="username" class="iconfont icon-user"></label>
</div><!-- end form-element -->
<div class="form-element">
<input type="text" class="form-text blue" name="email" id="username" placeholder="Email" />
<label for="username" class="iconfont icon-letter"></label>
</div><!-- end form-element -->
<div class="form-element">
<input type="text" class="form-text blue" name="city" id="username" placeholder="Preferred City" />
<label for="username" class="iconfont icon-map"></label>
</div><!-- end form-element -->
<div class="form-element last">
<button type="submit">Submit</button>
</div><!-- end form-element -->
</form>
</div><!-- end side -->
</div><!-- end serve-apply -->
</div><!-- end section -->
<div class="categories">
<div class="head">
<h3>categories</h3>
</div><!-- end head -->
<div class="body">
<ul>
<volist name="category_list" id="item">
<li><a href="{$item.href}"><em>{$item['title']}</em>
<i class="num"></i></a></li>
</volist>
</ul>
</div><!-- end body -->
</div><!-- end categories -->
<div style="clear:both;" />

Categories