Few problems at the same time, PHP - php

I'm working on one website but i'm confused.
<?php
ob_start("ob_gzhandler");
session_start();
define('FORUM_ROOT', 'forum/');
require FORUM_ROOT.'include/common.php';
// Where will we go after login?
$forum_page['redirect_url'] = 'http://l2topsites.net/';
$forum_page['form_action'] = forum_link($forum_url['login']);
$forum_page['hidden_fields'] = array(
'form_sent' => '<input type="hidden" name="form_sent" value="1" />',
'redirect_url' => '<input type="hidden" name="redirect_url" value="'.forum_htmlencode($forum_page['redirect_url']).'" />',
'csrf_token' => '<input type="hidden" name="csrf_token" value="'.generate_form_token($forum_page['form_action']).'" />'
);
include "conf.php";
$opala = $_GET['p'];
if (isset($opala)) {
$page = '_data/'.$opala.'.php';
} else {
$page = "_data/indexa.php";
}
if (!is_file($page)) {
echo 'This page not found!';
} else {
include "_data/".basename($page) ;
}
$sredata = ob_get_clean();
if(!isset($title)) $title = "[L2TopSites] - Top Lineage 2 Ranking Sites";
$online = mysql_fetch_assoc(mysql_query("SELECT SQL_CACHE COUNT(user_id) FROM `foo_online`"));
$online = $online['COUNT(user_id)'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title><? echo $title; ?></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="bg" />
<base href="http://l2topsites.net" />
<meta name="robots" content="all,follow" />
<meta name="google-site-verification" content="0G89ZsSF30caf4PJk17uLLtejlwnl8oO2mUN4ywZCw8" />
<meta name="description" content="Top Lineage2 Server only on TopZone.eu" />
<meta name="keywords" content="topzone, lineage2, servers, rank, votes, top10, top25, top100, lineage2 servers" />
<meta http-equiv="Cache-Control" content="max-age=3600" />
<link type="text/css" rel="stylesheet" href="/min/f=style.css" />
</head>
<body>
<div id="content">
<div id="maintop"></div>
<div id="main">
<div id="header">
<div id="lpanel">
<?
if (!$forum_user['is_guest'])
{
echo "<div class=\"usermenu\">";
echo "<img src=\"images/button1.png\" width=\"90\" height=\"23\" alt=\"\" /><br />";
echo "<img src=\"images/button2.png\" width=\"90\" height=\"23\" alt=\"\" /><br />";
echo "<img src=\"images/button3.png\" width=\"90\" height=\"23\" alt=\"\" />";
echo "</div><div id=\"ltext\" style=\"padding-top: 5px;\">";
echo "Logged in as: ".$forum_user['username']."";
if($forum_user['is_admmod']==1){
echo " | Admin Panel";
}
echo "</div>";
}
else
{
?>
<form action="<?php echo $forum_page['form_action'] ?>" method="post">
<?php echo implode("\n\t\t", $forum_page['hidden_fields'])."\n" ?>
<table border="0">
<tr><td width="10"><img class="img" src="images/user.png" width="17" height="19" alt="" /></td><td><input type="text" name="req_username" id="userinput" /></td></tr>
<tr><td width="10"><img class="img" src="images/pass.png" width="17" height="19" alt="" /></td><td><input type="password" name="req_password" id="passinput" /></td></tr>
</table>
<input type="submit" name="submit" value="" id="login" />
<img src="images/register.png" alt="" border="0" />
<div id="ltext">
Forget Password?
<input type="checkbox" id="input" name="save_pass" value="1" /><span>Remember me</span></div>
</form>
<? } ?>
</div>
</div>
<div id="mbaner1">
<div id="mb1l"></div>
<div id="mb1b">
<div id="mb1">
<img src="images/baner1.png" width="728" height="90" alt="" border="0" />
</div>
</div>
<div id="mb2r"></div>
</div>
<div id="left">
<div class="btop"></div>
<div class="mback">
<div id="box1t"></div>
<ul>
<li>Home</li>
<li>News</li>
<li>Contact</li>
</ul>
</div>
<div class="bbottom"></div>
<div class="btop"></div>
<div class="mback">
<div id="box2t"></div>
<ul>
<li>All Servers (by Vote)</li>
<li>All Servers (by Date)</li>
<li>Premium Servers</li>
<li>Search Server</li>
<li>Add Server</li>
</ul>
</div>
<div class="bbottom"></div>
<div class="btop"></div>
<div class="mback">
<div id="box3t"></div>
<ul>
<li>Crests</li>
<li>L2 Guides</li>
<li>Forum</li>
</ul>
</div>
<div class="bbottom"></div>
<div class="btop"></div>
<div id="aback">
<div id="box4t"></div>
<div id="adsense"><script type="text/javascript">
<!--
google_ad_client="pub-4584526598914996";google_ad_slot="3047263056";google_ad_width=121;google_ad_height=240;//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></div>
</div>
<div class="bbottom"></div>
</div>
<div id="mcontent">
<div id="glineage"></div>
<div id="mcontenttop"></div>
<div id="mcontentt">
<?php
echo $sredata;
$btemi = mysql_fetch_assoc(mysql_query("SELECT SQL_CACHE COUNT(id) FROM foo_topics"));
$broitemi = $btemi['COUNT(id)'];
$bposts = mysql_fetch_assoc(mysql_query("SELECT SQL_CACHE COUNT(id) FROM foo_posts"));
$broipostove = $bposts['COUNT(id)'];
$bservers = mysql_fetch_assoc(mysql_query("SELECT SQL_CACHE COUNT(id) FROM s_servers WHERE `odobren` = '1'"));
$broiserveri = $bservers['COUNT(id)'];
?>
<div style="clear: both;"></div>
</div>
<div id="mcontentbottom"></div>
</div>
<div id="right">
<div id="fserver">
<?php
$q = mysql_fetch_assoc(mysql_query("SELECT SQL_CACHE `fname`, `fid` FROM `s_set`"));
echo "<b>".$q['fname']."</b>";
?>
</div>
<div class="btop"></div>
<div id="rback">
<div id="box5t"></div>
<ul>
<li>Gaming Forums</li>
<li>Counter-Strike</li>
<li>MuOnline</li>
<li>Ragnarok Online</li>
<li>World Of Warcraft</li>
<li>OnlineGames</li>
<li>OnlineTop100</li>
</ul>
</div>
<div class="bbottom"></div>
<div class="btop"></div>
<div class="mback">
<div id="box6t"></div>
<ul>
<li>Your ip is: <?=$_SERVER['REMOTE_ADDR']?></li>
<li>Servers indexed: <?=$broiserveri?></li>
<li>Threads on forum: <?=$broitemi?></li>
<li>Posts on forum: <?=$broipostove?></li>
<li>Online users: <?=$online?></li>
</ul>
</div>
<div class="bbottom"></div>
<div class="btop"></div>
<div class="mback">
<div id="box7t"></div>
<ul>
<li>Tutorials</li>
<li>Links Direcotory</li>
<li>You link here?</li>
</ul>
</div>
<div class="bbottom"></div>
</div>
<div id="footer">
<div id="fooleft"></div>
<div id="foo">
<ul>
<li>Home | </li>
<li>ViewServers | </li>
<li>Register | </li>
<li>Crests | </li>
<li>Forum | </li>
<li>AddServer | </li>
<li>Contact | </li>
<li>Privacy Policy | </li>
<li>Terms and Conditions</li>
</ul>
<span id="tend">All right reserved L2Topsites © 2010-2011
L2Topsites.net is not responsable for any external content.
</div>
<div id="fooright"></div>
</div>
<div id="mainbottom"></div>
</div>
</div>
<script type="text/javascript" src="/min/f=javascript.js"></script>
<!-- NACHALO NA TYXO.BG BROYACH -->
<script type="text/javascript">
<!--
d=document;d.write('<a href="http://www.tyxo.bg/?87885" title="Tyxo.bg counter" target=" blank"><img width="1" height="1" border="0" alt="Tyxo.bg counter"');d.write(' src="http://cnt.tyxo.bg/87885?rnd='+Math.round(Math.random()*2147483647));d.write('&sp='+screen.width+'x'+screen.height+'&r='+escape(d.referrer)+'" /><\/a>');//-->
</script>
<noscript><img src="http://cnt.tyxo.bg/87885" width="1" height="1" border="0" alt="Tyxo.bg counter" /></noscript>
</body>
</html>
Error is
`Warning: ob_start(): output handler 'ob_gzhandler' conflicts with 'zlib output compression' in D:\xampp\htdocs\index.php on line 2
Notice: ob_start(): failed to create buffer in D:\xampp\htdocs\index.php on line 2`
I don't know if it is because of that but links are broken too.
Its like when I click somewhere it goes to
index.php/page
but its should go on
index.php?p=page

Related

How to create a edit profile page for users with PHP?

I've created a page but I can´t put the Save button working and regardless of the user I enter with, it appears the same user information for them all.
I think it's a loop problem but I'm not sure what it is.
<?php
require_once('LoginConfig.php');
session_start();
if(isset($_SESSION["email"])){
$user_check = $_SESSION["email"];
$result = $connect->prepare("SELECT * FROM users WHERE user_email = :usercheck");
$result->execute(array(":usercheck"=>$user_check));
$row = $result->fetch(PDO::FETCH_ASSOC);
}else
{
header("location:UsersLogin.php");
}
?>
<!DOCTYPE html>
<html lang="PT-pt">
<head>
<title> Editar Perfil - JamJam </title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:700, 600,500,400,300' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="http://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css">
<link rel="stylesheet" type="text/css" href="assets/css/style-menu.css">
<link rel="stylesheet" type="text/css" href="assets/css/style-articlelist2.css">
<script src="https://kit.fontawesome.com/8a368d3752.js"></script>
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/data.js"></script>
<script src="assets/js/main.js"></script>
<style>
</style>
</head>
<body>
<div class="header">
<div class="logo">
<i style='font-size:24px' class='fas'></i>
<span style='font-size:24px'>JamJam</span>
</div>
<span></span>
</div>
<div class="side-nav">
<div class="logo">
<i style='font-size:24px; color:rgb(0,255,0)' class='fas'></i>
<span style='font-size:24px'>JamJam</span>
</div>
<nav>
<ul>
<li>
<a href="UsersMenu.php">
<span><i style='color:rgb(0,255,0)' class="fas fa-home"></i></span>
<span>Página Inicial</span>
</a>
</li>
<li class="active">
<a href="UsersProfile.php">
<span><i style='color:rgb(0,255,0)' class="fa fa-user"></i></span>
<span>Perfil</span>
</a>
</li>
<li>
<a href="UsersArticleList.php">
<span><i style='color:rgb(0,255,0)' style='font-size:16px' class='fas'>&#xf001</i></span>
<span>Músicas</span>
</a>
</li>
<li>
<a href="Logout.php">
<span><i style='color:rgb(0,255,0)' class="fas fa-sign-out-alt"></i></span>
<span>Logout</span>
</a>
</li>
</ul>
</nav>
</div>
<div class="main-content">
<div class="title">
Editar Perfil
</div>
<div class="main">
<div class="widget" style="lex-basis: 98%; height: 750px;">
<?php
if(isset($_SESSION["email"])){
$result = $connect->prepare("SELECT user_id, user_name, user_bio, user_local, user_image FROM users");
$result->bindParam(':userid', $id);
$result->execute();
$row = $result->fetch()
?>
<form style="text-align: left; margin: 15px; " action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input $id="user_id" name="user_id" type="hidden" value= "<?php echo $row['user_id']; ?>">
<div >
<label for="username">Nome:</label><br>
<input type="text" name="username" value="<?php echo $row['user_name']; ?>">
</div>
<div>
<label for="bio">Bio:</label>
<br>
<textarea type="text" class="textarea" name="bio" rows ="4"><?php echo $row['user_bio']; ?></textarea>
</div>
<div>
<label for="local">Sítio onde vive:</label><br>
<input type="text" name="local" value="<?php echo $row['user_local']; ?>">
</div>
<div>
<label for="image">Foto de perfil atual:</label><br>
<img src="<?php echo 'images/' . $row['user_image']; ?>">
</div>
<div>
<br> <form action="upload.php" method="post" enctype="multipart/form-data">
<lable for="image">Selecionar nova foto de perfil:</lable><br>
<input type="file" name="fileToUpload" id="fileToUpload">
</form>
</div>
<div style="text-align: left; margin: 10px;" class="box">
<button style="float: left;" class="saveButton" type="submit">Guardar</button>
<a style="float: right;" class="cancelButton" href="UsersProfile.php">Cancelar</a>
</div>
</form>
<?php
}
?>
</div>
</div>
</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.

keeping the same stylesheet and display data same page issue

Code for index.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
include ('recherchecommande.php') ;
?>
<title>Pâtisserie Baya</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="all" href="styles/960.css" />
<link rel="stylesheet" type="text/css" media="all" href="styles/reset.css" />
<link rel="stylesheet" type="text/css" media="all" href="styles/text.css" />
<link rel="stylesheet" type="text/css" media="all" href="style.css" />
<link rel="stylesheet" type="text/css" media="all" href="themes/brown/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="styles/sample.css" />
<link rel="stylesheet" type="text/css" media="all" href="styles/table.css" />
<script type="text/javascript" src="scripts/jquery-1.4.2.js"></script>
<script type="text/javascript" src="scripts/jquery.tools.min.js"></script>
<script type="text/javascript" src="scripts/dapur.js"></script>
</head>
<body>
<div id="warp" >
<div id="main" class="container_16">
<div id="header" class="grid_16">
<div id="logo" class="grid_4 alpha">
<h1>DapurKue</h1>
<h2>Famously Delicious</h2>
</div>
<div id="headright" class="grid_7 prefix_5 omega">
<h3 class="login">Sign up / Login</h3>
<p><span class="vChart">View Cart</span> <span class="cOut">Checkout</span></p>
</div>
</div>
<div id="mainMenu" class="grid_16">
<ul>
<li>Home</li>
<li>Cakes</li>
<li>Order & Delivery</li>
<li>Blog</li>
<li>About</li>
<li>Contact</li>
<li>Reclamation</li>
</ul>
</div>
<div id="stickySearch" class="grid_16">
<div class="stickyNews grid_12 alpha">
<p>Valentine’s BrownieCheese Special Package. <em>Free Delivery.</em> More »</p>
</div>
<div class="search grid_4 omega">
<form action="#" method="get">
<input type="text" value="Type your keyword" id="s" name="s" onFocus="if (this.value == 'Type your keyword') {this.value = '';}" onBlur="if (this.value == '') {this.value = 'Type your keyword';}" />
</form>
</div>
</div>
<div class="products grid_16">
<div class="productsWarp" id="style1"><img src="images\email.png"></div>
<div id="style2" /> </div>
<div id ="style3">
<h3>Recherche par numero de commande</h3>
<p> Searcch button</p>
<form action="recherchecommande.php?go" id="commandeForm" method="post">
<input placeholder="Numero de commande.." id="form2" type="text" name="numero">
<input type="submit" name="submit" style="display: none" /><br>
</form>
</div>
<div id="style1"></div>
</div>
<div class="productThumb ">
<ul>
<li class="grid_2 alpha"><img src="images/cake1.jpg" alt="" width="100" height="60" /></li>
<li class="grid_2"><img src="images/cake2.jpg" alt="" width="100" height="60" /></li>
<li class="grid_2"><img src="images/cake3.jpg" alt="" width="100" height="60" /></li>
<li class="grid_2"><img src="images/cake4.jpg" alt="" width="100" height="60" /></li>
<li class="grid_2"><img src="images/cake5.jpg" alt="" width="100" height="60" /></li>
<li class="grid_2"><img src="images/cake6.jpg" alt="" width="100" height="60" /></li>
<li class="grid_2"><img src="images/cake7.jpg" alt="" width="100" height="60" /></li>
<li class="grid_2 omega"><img src="images/cake8.jpg" alt="" width="100" height="60" /></li>
</ul>
</div>
</div>
<div class="clear"></div>
</div>
<div id="fresh">
<div class="container_16">
<div id="freshCake" class="grid_16">
<div class="grid_1 alpha"> <a class="prevButton">«</a></div>
<div class="headLine grid_14">
<h3>Fresh from the oven</h3>
</div>
<div class="grid_1 omega"> <a class="nextButton">»</a></div>
</div>
<div class="newCakes">
<div class="scroller">
<div class="newCake"><img src="images/freshCake1.jpg" alt="" width="220" height="120" /></div>
<div class="newCake"><img src="images/freshCake2.jpg" alt="" width="220" height="120" /></div>
<div class="newCake"><img src="images/freshCake3.jpg" alt="" width="220" height="120" /></div>
<div class="newCake"><img src="images/freshCake4.jpg" alt="" width="220" height="120" /></div>
<div class="newCake"><img src="images/freshCake5.jpg" alt="" width="220" height="120" /></div>
<div class="newCake"><img src="images/freshCake6.jpg" alt="" width="220" height="120" /></div>
<div class="newCake"><img src="images/freshCake7.jpg" alt="" width="220" height="120" /></div>
<div class="newCake"><img src="images/freshCake8.jpg" alt="" width="220" height="120" /></div>
</div>
</div>
</div>
<div class="clear"></div>
</div>
<div id="richContent">
<div class="container_16">
<div class="popularCakes grid_4">
<h4>Popular Cakes</h4>
<ul>
<li>Ultimate Choco Brownie</li>
<li>Mokakokoa Brownie</li>
<li>CoffeeBrown</li>
<li>Delicacheese</li>
<li>Berries Cheesecake</li>
</ul>
</div>
<div class="recommended grid_4">
<h4>Recommended</h4>
<ul>
<li>Ultimate Choco Brownie</li>
<li>Mokakokoa Brownie</li>
<li>CoffeeBrown</li>
<li>Delicacheese</li>
<li>Berries Cheesecake</li>
</ul>
</div>
<div class="specialOffer grid_4">
<h4>Special Offer</h4>
<ul>
<li>Ultimate Choco Brownie</li>
<li>Mokakokoa Brownie</li>
<li>CoffeeBrown</li>
<li>Delicacheese</li>
<li>Berries Cheesecake</li>
</ul>
</div>
<div class="orderPhone grid_4">
<h4><em>Order by Phone</em> <span>20.321.331</span></h4>
</div>
<div class="clear"></div>
</div>
</div>
<div id="richContent2">
<div class="container_16">
<div class="fromBlog grid_4">
<h4>From the blog</h4>
<h5>New Recipes in Our Basket</h5>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. vivamus tempor justo sit amet metus cursus consequat. Nulla viverra, felis vel accumsan fermentum... more »</p>
</div>
<div class="corporateInfo grid_4">
<h4>Corporate Info</h4>
<ul>
<li>Privacy Policy</li>
<li>Term & Conditions</li>
<li>Franchise</li>
<li>About us</li>
<li>FAQ</li>
</ul>
</div>
<div class="storeDelivery grid_4">
<h4>Store & Delivery</h4>
<ul>
<li>Store Locator</li>
<li>Delivery Terms & Pricing</li>
<li>Delivery Coverage</li>
<li>Gift Services</li>
<li>Track my order</li>
</ul>
</div>
<div class="socialNet grid_4">
<h4>Keep in touch</h4>
<ul>
<li>Facebook</li>
<li>Twitter</li>
<li>Feed</li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
<div id="footer">
<div class="container_16">
<div class="copyright grid_16">
<p class="left">Copyright © 2016, Athenas, All Rights Reserved</p>
<p class="right">Design by Tokokoo & instantShift</p>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</div>
</body>
</html>
Code for search.php
<?php
include ('connect.php') ;
$mysqli = new mysqli("localhost", "root", "", "baya");
if(isset($_POST['submit'])){
if(isset($_GET['go'])){
$cmd=$_POST['numero'];
$sql="SELECT * from commande WHERE commande_id LIKE ".$cmd."";
$result=mysqli_query($db,$sql);
$number=$result->num_rows ;
echo "
" ;
if ($number==1)
{
while($row=mysqli_fetch_assoc($result))
{
$commande_id =$row['commande_id'];
$description=$row['description'];
$status=$row['status'];
$report=$row['report'] ;
echo "
<table border=1>
<thead>
<tr>
<th>commande_id</th>
<th>description</th>
<th>status</th>
<th>report</th>
</tr>
</thead>
<tr>
<td>$commande_id</td>
<td>$description</td>
<td>$status</td>
<td>$report</td>
</tr>
";
header('location reclamation.html') ;
}
}
else{
echo "<p>Command id n'existe pas</p>";
}
}
}
else{
echo "search query is empty" ;
}
?>
I want to show the query in the same page not another one
For example if i type 1 it should returns this query from database
not to show the result in another page ..
Is it possible to show the result at the bottom of the Search button with
the same style sheet !
Thank you everybody for helping !
Best regards
change your form action attribute like this
<form action="" mehtode="post">
and write the php code on the same page to process the data send.
<?php
if(isset($_POST['submit'])){
//process the form
//output
// etc....
}
?>
Please post the code sample. So we can have a look at it.
You can use other php file with includes with the same css and html structure of you other php, or you can use Ajax with javascript for get the data and then show it.
$.ajax({
method: "POST",
url: "some.php",
data: { name: "John", location: "Boston" }
})
.done(function( msg ) {
alert( "Data Saved: " + msg );
});

Is it possible to get 'Session User" to display

Hi there I'm trying to get a user who comments and is logged in to their account for their 'Login Name' to display when they comment currenlty when a user wants to comment it asks for their name and their comment. Is it possible to display their name getting it from the session to display it? Thanks!
http://puu.sh/cByNU/697e58cdf6.jpg http://puu.sh/cByNU/697e58cdf6.jpg
On the image I'm logged in as 'Testing' is it possible to remove the field 'Name' and when they post a comment it will get their name where the search box is (testing).
Thanks!
My CODE:
<?php
session_start();
include "../includes/config.php";
include "function.php";
include ('../includes/header.php');
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Honda</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='http://fonts.googleapis.com/css?family=Julius+Sans+One' rel='stylesheet' type='text/css'>
<link href="../css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--start lightbox -->
<link rel="stylesheet" type="text/css" href="../css/jquery.lightbox.css">
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.lightbox.js"></script>
<script>
// Initiate Lightbox
$(function() {
$('.gallery1 a').lightbox();
});
</script>
</head>
<body>
<!--start header-->
<div class="h_bg">
<div class="wrap">
<div class="wrapper">
<div class="header">
<div class="logo">
<img src="../images/logo.png">
</div>
<div class="cssmenu">
<ul>
<li><span>Home</span></li>
<li><span>About</span></li>
<li class="active" class="has-sub"><span>Gallery</span>
</li>
<li class="last"><span>Contact</span></li>
<div class="clear"></div>
<form action="search.php" method="GET">
<div class="search">
<h2>search</h2>
<form>
<input type="text" name="query" placeholder="Enter Your search..." />
<input type="submit" value="">
</form>
</div>
</form>
<div class="search1">
<form action="" method="POST">
<br>
<h2>Welcome, <?=$_SESSION['sess_user'];?>!</h2><br><br>
<div class="pw">
<h3>Change details</h3>
</div>
<br><br>
<h2>Logout</h2>
</form>
</div>
</div>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start content -->
<div class="content_bg">
<div class="wrap">
<div class="wrapper">
<div class="main">
<div class="ser-main">
<h2 class="style">Gallery of honda</h2>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic1.jpg" alt="">
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic2.jpg" alt="">
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic3.jpg" alt="">
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic4.jpg" alt="">
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="footer_bg">
<div class="wrap">
<div class="wrapper">
<div class="footer">
<div class="search69">
<?php
if(isset($_POST['submit'])
&& !empty($_POST['name'])
&& !empty($_POST['comment']) ){
$name=$_POST['name'];
$comment=$_POST['comment'];
$submit=$_POST['submit'];
$insert=mysql_query("INSERT INTO comment (name,comment) VALUES ('$name','$comment') ");
echo "<meta HTTP-EQUIV='REFRESH' content='0; url=service.php'>";
}
else
{
echo "";
}
?>
<form class="comments" action="service.php" method="POST">
<h2>Name: </h2><br><input type="text" name="name" required/><br><br>
<h2>Comment:</h2><textarea name="comment" rows="10" cols="50" required></textarea><br><br><br>
<input type="submit" name="submit" value="Comment">
</form>
<?php
$getquery=mysql_query("SELECT * FROM comment ORDER BY id DESC");
while($rows=mysql_fetch_assoc($getquery))
{
$id=$rows['id'];
$date=$rows['date'];
$name=$rows['name'];
$comment=$rows['comment'];
echo '<h2><hr size="1"/><br><font color="green">' . $name . '</font><h2><br/>' . '<br/>' . $comment . '<br/><br><font color="red">' . $date. '</font><br/>' . '<hr size="1"/>'
;}
?>
</div>
<div class="copy">
<p class="w3-link">2014 </p>
Privacy & Policy
</div>
<div class="f_nav">
<ul>
<li>Skype</li>
<li>Linked in</li>
<li>Twitter</li>
<li>Facebook</li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</body>
</html>
(ALL MY CODE ON THAT PAGE)
UPDATE:
The guys here will kill me, because now i am just edited your code, and not rewrite to mysqli or PDO, but as i saw, you stuck, so i've just updated, bacause i do not want to confuse with that too. I do some modifications, check my comments about that. (Moved the block of insertion to the top of file, add an error message, remove unnecesarry variables, rename the rows variable to row, etc...)
<?php
session_start();
include "../includes/config.php";
include "function.php";
include ('../includes/header.php');
//Set an empty errorMsg because later we will check it.
$errorMsg = '';
//If everything is set, or the SESSION["sess_user"] not empty.
//I moved this whole thing here, because if there are no output, we can
//redirect user from PHP, and do not need to use META REFREHS...
if (isset($_POST['submit']) && !empty($_POST['comment']) && (!empty($_POST["name"]) || !empty($_SESSION["sess_user"]))) {
if (!empty($_SESSION["sess_user"])) {
$name = $_SESSION["sess_user"];
} else {
$name = $_POST["name"];
}
//$comment = $_POST['comment']; //Use $_POST["comment"] directly
//$submit = $_POST['submit']; //Do not use it anywhere
$insert = mysql_query("INSERT INTO comment (name,comment) VALUES ('" . mysql_real_escape_string($name) . "','" . mysql_real_escape_string($_POST["comment"]) . "')");
Header("Location: service.php");
} else {
$errorMsg = "You need to fill all the fields.";
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Honda</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link href='http://fonts.googleapis.com/css?family=Julius+Sans+One' rel='stylesheet' type='text/css'>
<link href="../css/style.css" rel="stylesheet" type="text/css" media="all" />
<!--start lightbox -->
<link rel="stylesheet" type="text/css" href="../css/jquery.lightbox.css">
<script src="../js/jquery.min.js"></script>
<script src="../js/jquery.lightbox.js"></script>
<script>
// Initiate Lightbox
$(function() {
$('.gallery1 a').lightbox();
});
</script>
</head>
<body>
<!--start header-->
<div class="h_bg">
<div class="wrap">
<div class="wrapper">
<div class="header">
<div class="logo">
<img src="../images/logo.png">
</div>
<div class="cssmenu">
<ul>
<li><span>Home</span></li>
<li><span>About</span></li>
<li class="active" class="has-sub"><span>Gallery</span>
</li>
<li class="last"><span>Contact</span></li>
<div class="clear"></div>
<form action="search.php" method="GET">
<div class="search">
<h2>search</h2>
<form>
<input type="text" name="query" placeholder="Enter Your search..." />
<input type="submit" value="">
</form>
</div>
</form>
<div class="search1">
<form action="" method="POST">
<br>
<h2>Welcome, <?= $_SESSION['sess_user']; ?>!</h2><br><br>
<div class="pw">
<h3>Change details</h3>
</div>
<br><br>
<h2>Logout</h2>
</form>
</div>
</div>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<!-- start content -->
<div class="content_bg">
<div class="wrap">
<div class="wrapper">
<div class="main">
<div class="ser-main">
<h2 class="style">Gallery of honda</h2>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic1.jpg" alt="">
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic2.jpg" alt="">
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic3.jpg" alt="">
</div>
</div>
<div class="ser-grid-list img_style">
<div class="gallery1">
<img src="../images/ser_pic4.jpg" alt="">
</div>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<div class="footer_bg">
<div class="wrap">
<div class="wrapper">
<div class="footer">
<div class="search69">
<?php
//Added here the errorMsg
if (!empty($errorMsg)) {
?>
<div class="error"><?php echo $errorMsg; ?></div>
<?php
}
?>
<form class="comments" action="service.php" method="POST">
<?php
if (!empty($_SESSION['sess_user'])) {
//If user logged in, use the name of it
?>
<h2>Name: </h2><br><?php echo $_SESSION['sess_user']; ?>
<br><br>
<?php
} else {
//Else, ask it
?>
<h2>Name: </h2><br><input type="text" name="name" required/><br><br>
<?php
}
?>
<h2>Comment:</h2><textarea name="comment" rows="10" cols="50" required></textarea><br><br><br>
<input type="submit" name="submit" value="Comment">
</form>
<?php
$getquery = mysql_query("SELECT * FROM comment ORDER BY id DESC");
//This is one row, not rows
while ($row = mysql_fetch_assoc($getquery)) {
/*
* These are not necessary
$id = $rows['id'];
$date = $rows['date'];
$name = $rows['name'];
$comment = $rows['comment'];
*/
echo '<h2><hr size="1"/><br><font color="green">' . $row['name'] . '</font><h2><br/>' . '<br/>' . $row['comment'] . '<br/><br><font color="red">' . $row['date'] . '</font><br/>' . '<hr size="1"/>'
;
}
?>
</div>
<div class="copy">
<p class="w3-link">2014 </p>
Privacy & Policy
</div>
<div class="f_nav">
<ul>
<li>Skype</li>
<li>Linked in</li>
<li>Twitter</li>
<li>Facebook</li>
</ul>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
</body>
</html>
NOTE: Do not use mysql functions since they are deprecated. use mysqli or PDO functions instead.
Acoid for sql injections, so escape your data!
If i got it well, you want the form to automatically gets the name of a logged user. You should:
<?php $username = isset($_SESSION['sess_user']) ? $_SESSION['sess_user'] : "";?>
To store the username or "" into $username, depending on whether user is authentified or not. Then in your input line within the form:
<h2>Name: </h2><br><input type="text" name="name" value="<?php echo $username; ?>" required/><br><br>

Php file renders blank after being converted with Haml (Ruby)!

In order to test if the converted index.haml would work on with my wamp and localhost i did the following:
First, I renamed my index.php into index.html
Then, I typed html2haml index.html index.haml in the command line
Then, I typed haml index.haml indexnew.html in the command line
I renamed indexnew.html to indexnew.php
I tested it: localhost/projects/cross-browser/base0.9/indexnew.php
but the indexnew.php was rendered blank even if the code inside is ok:
Original Php (index.php):
<?php
include_once 'localization.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"/>
<title>Alex Chen - Web Development, Graphic Design, and Translation</title>
<link rel="stylesheet" type="text/css" href="styles/reset.css" />
<link rel="stylesheet" type="text/css" href="styles/global.css" />
<link rel="stylesheet" type="text/css" href="fancybox/jquery.fancybox-1.3.1.css" />
<?php if($lang_file=='lang.zh-tw.php' || $lang_file=='lang.zh-cn.php') {echo '<link rel="stylesheet" type="text/css" href="styles/chinese.css" />';} ?>
<script type="text/javascript" src="scripts/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="scripts/jquery.validate.js"></script>
<script type="text/javascript" src="fancybox/jquery.fancybox-1.3.1.pack.js"></script>
<script type="text/javascript" src="scripts/jquery.scrollTo-min.js"></script>
<script type="text/javascript" src="scripts/jquery.localscroll-min.js"></script>
<script type="text/javascript" src="scripts/custom.js"></script>
<?php if($lang_file=='lang.en.php') {echo '<script type="text/javascript" src="scripts/jquery-validate/val-en.js"></script>';} ?>
<?php if($lang_file=='lang.es.php') {echo '<script type="text/javascript" src="scripts/jquery-validate/val-es.js"></script>';} ?>
<?php if($lang_file=='lang.zh-tw.php') {echo '<script type="text/javascript" src="scripts/jquery-validate/val-zh-tw.js"></script>';} ?>
<?php if($lang_file=='lang.zh-cn.php') {echo '<script type="text/javascript" src="scripts/jquery-validate/val-zh-cn.js"></script>';} ?>
</head>
<body id="home">
<div id="header">
<div class="container">
<div id="banner">
<ul id="lang">
<li <?php if($lang_file=='lang.en.php') {echo 'class="current"';} ?>>ENGLISH</li>
<li <?php if($lang_file=='lang.es.php') {echo 'class="current"';} ?>><?php echo l('nav_a0'); ?></li>
<li <?php if($lang_file=='lang.zh-tw.php') {echo 'class="current"';} ?>><?php echo l('nav_a1'); ?></li>
<li <?php if($lang_file=='lang.zh-cn.php') {echo 'class="current"';} ?>><?php echo l('nav_a2'); ?></li>
</ul>
<div id="logo">
<h1><a>ALEXCHEN</a></h1>
</div>
<div id="logo2">
<ul id="nav">
<li><?php echo l('nav1'); ?></li>
<li><?php echo l('nav2'); ?></li>
</ul>
</div>
<div id="logo3">
</div>
</div><!-- #header-bottom -->
</div><!-- .container -->
</div><!-- #header -->
<div id="content">
<div class="container">
<div class="showcase">
<div class="first">
<div id="nopic">
<p><?php echo l('tagline_p'); ?></p>
</div>
</div>
<div class="pusher">
<h3><?php echo l('showcase1_h3'); ?></h3>
<p><?php echo l('showcase1_p'); ?></p>
<div class="pic">
<a id="showcase1" href="#inline1"><img src="images/showcase1t.png"/></a>
<div id="inline1">
<img src="images/showcase1.png"/>
studyatbest.com
</div>
</div>
</div>
<div class="pusher">
<h3><?php echo l('showcase2_h3'); ?></h3>
<p><?php echo l('showcase2_p'); ?></p>
<div class="pic">
<a id="showcase2" href="#inline2"><img src="images/showcase2t.png"/></a>
<div id="inline2">
<img src="images/showcase2.png"/>
spacestudios.com
</div>
</div>
</div><!-- .pushed -->
<div class="pusher">
<h3><?php echo l('showcase3_h3'); ?></h3>
<p><?php echo l('showcase3_p'); ?></p>
<div class="pic">
<a id="showcase3" href="#inline3"><img src="images/showcase3t.png"/></a>
<div id="inline3">
<img src="images/showcase3.png"/>
alexchen.com
</div>
</div>
</div>
<div class="pusher">
<h3><?php echo l('showcase4_h3'); ?></h3>
<p><?php echo l('showcase4_p'); ?></p>
<div class="pic">
<a id="showcase4" href="#inline4"><img src="images/showcase4t.png"/></a>
<div id="inline4">
<img src="images/showcase4.png"/>
mattsai.com
</div>
</div>
</div>
<div class="pusher">
<h3><?php echo l('showcase5_h3'); ?></h3>
<p><?php echo l('showcase5_p'); ?></p>
<div class="pic">
<a id="showcase5" href="#inline5"><img src="images/showcase5t.png"/></a>
<div id="inline5">
<img src="images/showcase5.png"/>
mattsai.com
</div>
</div>
</div><!-- .pusher -->
<div class="pusher">
<h3><?php echo l('showcase6_h3'); ?></h3>
<p><?php echo l('showcase6_p'); ?></p>
<div class="pic">
<a id="showcase6" href="#inline6"><img src="images/showcase6t.png"/></a>
<div id="inline6">
<img src="images/showcase6.png"/>
mattsai.com
</div>
</div>
</div>
<div class="pusher">
<h3><?php echo l('showcase8_h3'); ?></h3>
<p><?php echo l('showcase8_p'); ?></p>
<div class="pic">
<a id="showcase8" href="#inline8"><img src="images/showcase8t.png"/></a>
<div id="inline8">
<img src="images/showcase8.png"/>
mattsai.com
</div>
</div>
</div><!-- .pusher -->
</div><!-- .showcase -->
</div><!-- .container -->
</div><!-- #work -->
<div id="footer">
<div class="container">
<div id="footer-top">
<div id="about">
<h3><?php echo l('about_h3'); ?></h3>
<p><?php echo l('about_p'); ?></p>
</div>
<div id="info">
<h3><?php echo l('info_h3'); ?></h3>
<ul>
<li id="tel"><?php echo l('_info_li2'); ?><p>Tel:</p> 0918051170</li>
<li id="gmail"><?php echo l('_info_li3'); ?><p></p>alexchen.net#gmail.com</li>
<li id="facebook"><?php echo l('_info_li4'); ?> facebook</li>
</ul>
</div>
<div id="contact">
<h3><?php echo l('contact_h3'); ?></h3>
<p><?php echo l('_contact_p'); ?></p>
<form id="sendmail" method="post" action="http://www.emailmeform.com/fid.php?formid=254816">
<label for="name"><?php echo l('form_label1'); ?></label>
<input type="text" id="name" name="FieldData0" />
<label for="email"><?php echo l('form_label2'); ?></label>
<input type="text" id="email" name="FieldData1" />
<label for="message"><?php echo l('form_label3'); ?></label>
<textarea type="text" id="message" name="FieldData2"></textarea>
<input id="button" type="submit" value="<?php echo l('submit'); ?>">
</form>
</div>
</div><!-- #footer-top -->
<div id="footer-bottom">
<p>Copyright © 2010 Alex Chen. All Rights Reserved. Hosted on Zymic. Contact form hosted on Email Me Form.<a id="nr" href="http://www.freedomain.co.nr/cheap_web_hosting.php" target="_blank"><img src="http://ruarmza.4u.com.ru/ch.gif" alt="Cheap Web Hosting Providers" width="88" height="31" border="0" /></a></p>
</div>
</div><!-- .container -->
</div><!-- #footer -->
<script type="text/javascript" src="scripts/google-analytics.js"></script>
<script type="text/javascript" src="scripts/page-tracker.js"></script>
</body>
</html>
Converted Php (indexnew.php):
<?php include_once 'localization.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
<meta content='IE=EmulateIE7' http-equiv='X-UA-Compatible' />
<title>Alex Chen - Web Development, Graphic Design, and Translation</title>
<link href='styles/reset.css' rel='stylesheet' type='text/css' />
<link href='styles/global.css' rel='stylesheet' type='text/css' />
<link href='fancybox/jquery.fancybox-1.3.1.css' rel='stylesheet' type='text/css' />
<?php if($lang_file=='lang.zh-tw.php' || $lang_file=='lang.zh-cn.php') {echo '<link rel="stylesheet" type="text/css" href="styles/chinese.css" ?>
';} ?>
<script src='scripts/jquery-1.3.2.min.js' type='text/javascript'></script>
<script src='scripts/jquery.validate.js' type='text/javascript'></script>
<script src='fancybox/jquery.fancybox-1.3.1.pack.js' type='text/javascript'></script>
<script src='scripts/jquery.scrollTo-min.js' type='text/javascript'></script>
<script src='scripts/jquery.localscroll-min.js' type='text/javascript'></script>
<script src='scripts/custom.js' type='text/javascript'></script>
<?php if($lang_file=='lang.en.php') {echo '<script type="text/javascript" src="scripts/jquery-validate/val-en.js?>
';} ?>
<?php if($lang_file=='lang.es.php') {echo '<script type="text/javascript" src="scripts/jquery-validate/val-es.js?>
';} ?>
<?php if($lang_file=='lang.zh-tw.php') {echo '<script type="text/javascript" src="scripts/jquery-validate/val-zh-tw.js?>
';} ?>
<?php if($lang_file=='lang.zh-cn.php') {echo '<script type="text/javascript" src="scripts/jquery-validate/val-zh-cn.js?>
';} ?>
</head>
<body id='home'>
<div id='header'>
<div class='container'>
<div id='banner'>
<ul id='lang'>
<li
<?php if($lang_file=='lang.en.php') {echo 'class="current"';} ?>
>
</ul>
<a href='index.php?lang=en'>ENGLISH</a>
<li
<?php if($lang_file=='lang.es.php') {echo 'class="current"';} ?>
>
<a href='index.php?lang=es'>
<?php echo l('nav_a0'); ?>
</a>
<li
<?php if($lang_file=='lang.zh-tw.php') {echo 'class="current"';} ?>
>
<a href='index.php?lang=zh-tw'>
<?php echo l('nav_a1'); ?>
</a>
<li
<?php if($lang_file=='lang.zh-cn.php') {echo 'class="current"';} ?>
>
<a href='index.php?lang=zh-cn'>
<?php echo l('nav_a2'); ?>
</a>
<div id='logo'>
<h1>
<a>ALEXCHEN</a>
</h1>
</div>
<div id='logo2'>
<ul id='nav'>
<li>
<a href='#content'>
<?php echo l('nav1'); ?>
</a>
</li>
<li>
<a href='#contact'>
<?php echo l('nav2'); ?>
</a>
</li>
</ul>
</div>
<div id='logo3'></div>
</div>
<!-- #header-bottom -->
</div>
<!-- .container -->
</div>
<!-- #header -->
<div id='content'>
<div class='container'>
<div class='showcase'>
<div class='first'>
<div id='nopic'>
<p>
<?php echo l('tagline_p'); ?>
</p>
</div>
</div>
<div class='pusher'>
<h3>
<?php echo l('showcase1_h3'); ?>
</h3>
<p>
<?php echo l('showcase1_p'); ?>
</p>
<div class='pic'>
<a href='#inline1' id='showcase1'>
<img src='images/showcase1t.png' />
</a>
<div id='inline1'>
<img src='images/showcase1.png' />
<a href='http://studyatbest.com'>studyatbest.com</a>
</div>
</div>
</div>
<div class='pusher'>
<h3>
<?php echo l('showcase2_h3'); ?>
</h3>
<p>
<?php echo l('showcase2_p'); ?>
</p>
<div class='pic'>
<a href='#inline2' id='showcase2'>
<img src='images/showcase2t.png' />
</a>
<div id='inline2'>
<img src='images/showcase2.png' />
<a href='http://studyatbes.com'>spacestudios.com</a>
</div>
</div>
</div>
<!-- .pushed -->
<div class='pusher'>
<h3>
<?php echo l('showcase3_h3'); ?>
</h3>
<p>
<?php echo l('showcase3_p'); ?>
</p>
<div class='pic'>
<a href='#inline3' id='showcase3'>
<img src='images/showcase3t.png' />
</a>
<div id='inline3'>
<img src='images/showcase3.png' />
<a href='http://studyatbes.com'>alexchen.com</a>
</div>
</div>
</div>
<div class='pusher'>
<h3>
<?php echo l('showcase4_h3'); ?>
</h3>
<p>
<?php echo l('showcase4_p'); ?>
</p>
<div class='pic'>
<a href='#inline4' id='showcase4'>
<img src='images/showcase4t.png' />
</a>
<div id='inline4'>
<img src='images/showcase4.png' />
<a href='http://studyatbes.com'>mattsai.com</a>
</div>
</div>
</div>
<div class='pusher'>
<h3>
<?php echo l('showcase5_h3'); ?>
</h3>
<p>
<?php echo l('showcase5_p'); ?>
</p>
<div class='pic'>
<a href='#inline5' id='showcase5'>
<img src='images/showcase5t.png' />
</a>
<div id='inline5'>
<img src='images/showcase5.png' />
<a href='http://studyatbes.com'>mattsai.com</a>
</div>
</div>
</div>
<!-- .pusher -->
<div class='pusher'>
<h3>
<?php echo l('showcase6_h3'); ?>
</h3>
<p>
<?php echo l('showcase6_p'); ?>
</p>
<div class='pic'>
<a href='#inline6' id='showcase6'>
<img src='images/showcase6t.png' />
</a>
<div id='inline6'>
<img src='images/showcase6.png' />
<a href='http://studyatbes.com'>mattsai.com</a>
</div>
</div>
</div>
<div class='pusher'>
<h3>
<?php echo l('showcase8_h3'); ?>
</h3>
<p>
<?php echo l('showcase8_p'); ?>
</p>
<div class='pic'>
<a href='#inline8' id='showcase8'>
<img src='images/showcase8t.png' />
</a>
<div id='inline8'>
<img src='images/showcase8.png' />
<a href='http://studyatbes.com'>mattsai.com</a>
</div>
</div>
</div>
<!-- .pusher -->
</div>
<!-- .showcase -->
</div>
<!-- .container -->
</div>
<!-- #work -->
<div id='footer'>
<div class='container'>
<div id='footer-top'>
<div id='about'>
<h3>
<?php echo l('about_h3'); ?>
</h3>
<p>
<?php echo l('about_p'); ?>
</p>
</div>
<div id='info'>
<h3>
<?php echo l('info_h3'); ?>
</h3>
<ul>
<li id='tel'>
<?php echo l('_info_li2'); ?>
<p>Tel:</p>
0918051170
</li>
<li id='gmail'>
<?php echo l('_info_li3'); ?>
<p></p>
<a href='mailto:janoochen#gmail.com'>alexchen.net#gmail.com</a>
</li>
<li id='facebook'>
<?php echo l('_info_li4'); ?>
<a href='http://www.facebook.com/weedd.chen'>facebook</a>
</li>
</ul>
</div>
<div id='contact'>
<h3>
<?php echo l('contact_h3'); ?>
</h3>
<p>
<?php echo l('_contact_p'); ?>
</p>
<form action='http://www.emailmeform.com/fid.php?formid=254816' id='sendmail' method='post'>
<label for='name'>
<?php echo l('form_label1'); ?>
</label>
<input id='name' name='FieldData0' type='text' />
<label for='email'>
<?php echo l('form_label2'); ?>
</label>
<input id='email' name='FieldData1' type='text' />
<label for='message'>
<?php echo l('form_label3'); ?>
</label>
<textarea id='message' name='FieldData2' type='text'></textarea>
<input id='button' type='submit' value="<?php echo l('submit'); ?>" />
</form>
</div>
</div>
<!-- #footer-top -->
<div id='footer-bottom'>
<p>
Copyright © 2010 Alex Chen. All Rights Reserved. Hosted on
<a href='http://www.zymic.com'>Zymic</a>.
Contact form hosted on
<a href='http://www.emailmeform.com'>Email Me Form</a>.
<a href='http://www.freedomain.co.nr/cheap_web_hosting.php' id='nr' target='_blank'>
<img alt='Cheap Web Hosting Providers' border='0' height='31' src='http://ruarmza.4u.com.ru/ch.gif' width='88' />
</a>
</p>
</div>
</div>
<!-- .container -->
</div>
<!-- #footer -->
<script src='scripts/google-analytics.js' type='text/javascript'></script>
<script src='scripts/page-tracker.js' type='text/javascript'></script>
</body>
</html>
Any suggestions?
I'd suggest you try a PHP-specific version of HAML, like PHPHaml or pHAML. The Ruby HAML interpreter is specifically expecting Ruby code, and will likely screw up your PHP syntax.
Having said that, I have used Chaml with some degree of success. HAML for PHP is at a rather experimental stage, and you will come across bugs. If you're writing more HTML than PHP though, it can be a great help.

Categories