[php][html] cant figure out why there is an error - php

i will very thankful if someone could help me figure out why there is an error on line 37,i tried to change the location of the ""; after echo but nothing worked.... i also tried to put the whole php code in img class="profilePic" src="http://i.imgur.com/ZICYW5z.png"/> then to use echo for the name (i want it to change image and name on login.)
code:
<?php
require ('steamauth/steamauth.php');
# You would uncomment the line beneath to make it refresh the data every time the page is loaded
// $_SESSION['steam_uptodate'] = false;
?>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="./css/stylesheet.css" media="screen" title="no title" charset="utf-8">
<script src="./js/jquery-2.1.4.min.js" charset="utf-8"></script>
<title>CSGOSuprise.party</title>
<style>
html
{ background-image: url("images/background.jpg"); }
</style>
<body ondragstart="return false" onselectstart="return false">
<div class="header">
<ul>
<li class="logo">CSGOSuprise</li>
<?php
if(!isset($_SESSION['steamid'])) {
steamlogin();
} else {
include ('steamauth/userInfo.php');
?>
<li>Help</li>
</ul>
</div>
</head>
<body ondragstart="return false" onselectstart="return false">
<div class="container">
<div class="leftMain">
<div class="profile">
<div class="profileTop">
<?php echo '<img class="profilePic" src=.$steamprofile['avatarfull'].'; ?>
<?php echo '' . $steamprofile['personaname'] . ''; ?>
<div class="medals">
<img src="./images/medals/italy_small.png" alt="" />
<img src="./images/medals/dust2_small.png" alt="" />
<img src="./images/medals/victory_small.png" alt="" />
<img src="./images/medals/inferno_small.png" alt="" />
</div>
<div class="rankXP">
<img class="rankXPImage" src="./images/ranks/xp/level39.png" alt="" />
<span class="rankXPCurrent">Rank 39</span>
<span class="rankXPNext">Rank 40</span>
<progress id="xp" value="95" max="100"></progress>
</div>
</div>
<div class="rankComp">
<img class="rankCompImage" src="./images/ranks/comp/14.png" alt="" />
<div class="rankCompText">Distinguished Master Guardian</div>
<div class="wins">
<img class="rankTrophy" src="./images/trophy.png"/>
<span class="winNumber">232</span>
</div>
</div>
</div>
<div class="friendsMain">
<div class="friendsTop">
<span>Friends</span>
</div>
<div class="friendsList">
<div class="friendOnline">
<img class="profilePicSmall" src="http://i.imgur.com/ZICYW5z.png" alt="" />
<div class="friendNameOnline">8</div>
</div>
<div class="friendOnline">
<img class="profilePicSmall" src="http://i.imgur.com/ZICYW5z.png" alt="" />
<div class="friendNameOnline">7</div>
</div>
<div class="friendOnline">
<img class="profilePicSmall" src="http://i.imgur.com/ZICYW5z.png" alt="" />
<div class="friendNameOnline">4</div>
</div>
<div class="friendOffline">
<img class="profilePicSmall" src="http://i.imgur.com/ZICYW5z.png" alt="" />
<div class="friendNameOffline">6</div>
</div>
<div class="friendOffline">
<img class="profilePicSmall" src="http://i.imgur.com/ZICYW5z.png" alt="" />
<div class="friendNameOffline">5</div>
</div>
<div class="friendOffline">
<img class="profilePicSmall" src="http://i.imgur.com/ZICYW5z.png" alt="" />
<div class="friendNameOffline">4</div>
</div>
<div class="friendOffline">
<img class="profilePicSmall" src="http://i.imgur.com/ZICYW5z.png" alt="" />
<div class="friendNameOffline">3</div>
</div>
<div class="friendOffline">
<img class="profilePicSmall" src="http://i.imgur.com/ZICYW5z.png" alt="" />
<div class="friendNameOffline">2</div>
</div>
<div class="friendOffline">
<img class="profilePicSmall" src="http://i.imgur.com/ZICYW5z.png" alt="" />
<div class="friendNameOffline">1</div>
</div>
</div>
</div>
</div>
<div class="rightMain">
<div class="main"></div>
</div>
</div>
<script src="./js/script.js" charset="utf-8"></script>
</body>
</html>

I think instead of
<?php echo '<img class="profilePic" src=.$steamprofile['avatarfull'].'; ?>
you mean
<?php echo '<img class="profilePic" src="' . $steamprofile['avatarfull'] . '">'; ?>
But you could also do
<img class="profilePic" src="<?= $steamprofile['avatarfull'] ?>">

Related

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 );
});

Not able to access data on php page sent by ajax?

I have a html form with code shown below in which i have used ajax to send the id of the clicked button to the php page, but i am not getting any value to the php page, it is sending null.
I am a beginner in this and have studied via tutorials, can anybody point out the mistake i am doing?
<!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">
<head>
<title>ABC Fashion</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script type = "text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"> </script>
<script>
$(document).ready(function(){
$("button").click(function(){
alert((this).id);
var id=(this).id;
$.post("code.php", id);
});
});
</script>
</head>
<body>
<div id="main_container">
<div class="center_content" align="center">
<div class="center_title_bar" align="center">Latest Products</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Levi's Men's Cotton T-Shirt</div>
<div class="product_img"><img src="images/T1.jpg" name="tshirt" alt="" border="0" id="T1"/></div>
<div class="product_img"><button id="d1" onclick="">Dislike</button></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">UB Stylish T-shirt</div>
<div class="product_img"><img src="images/T2.jpg" name="tshirt" alt="" border="0" id="T2"/></div>
<div class="product_img"><div class="product_img"><button id="d2" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Jacob n John T-Shirt</div>
<div class="product_img"><img src="images/T3.jpg" name="tshirt" alt="" border="0" id="T3"/></div>
<div class="product_img"><div class="product_img"><button id="d3" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Levi's Men's Cotton T-Shirt</div>
<div class="product_img"><img src="images/T4.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d4" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">UB Stylish T-shirt</div>
<div class="product_img"><img src="images/T5.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d5" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Jacob n John T-Shirt</div>
<div class="product_img"><img src="images/T6.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d6" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Levi's Men's Cotton T-Shirt</div>
<div class="product_img"><img src="images/T7.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d7" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">UB Stylish T-shirt</div>
<div class="product_img"><img src="images/T8.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d8" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Jacob n John T-Shirt</div>
<div class="product_img"><img src="images/T9.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d9" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Levi's Men's Cotton T-Shirt</div>
<div class="product_img"><img src="images/T10.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d10" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">UB Stylish T-shirt</div>
<div class="product_img"><img src="images/T11.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d11" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Jacob n John T-Shirt</div>
<div class="product_img"><img src="images/T12.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d12" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
</div>
</body>
</html>
My php code is as follows:
<?php
$servername = "localhost";
$username = "admin";
$password = "pwd";
$dbname = "testdb";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_error($conn));
}
$num= (int)$_POST[id];
$str = $num;
$tempid = substr_replace($str,"T",0);
echo $tempid;
$sql = "INSERT INTO `test` (`disliked`) VALUES ('$num')";
if (mysqli_query($conn, $sql) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
The issue is in the $.post call, you're passing the value of id with no identifier.
Change this:
$.post("code.php", id);
to this:
$.post("code.php", {id: id});
Remember we need to send
Key=>value pair.
You are directly passing value in your Ajax post method so key is missing and you are trying to access using key.
Var params = {id:id};//first Id is key : second id is value.
$.post("code.php", params);
replace the $.post("code.php", id); with
var request = $.ajax({
url: "code.php",
type: "POST",
data: {id:id},
dataType: "html"
});
request.done(function(msg){
alert(msg);
});
request.fail(function(jqXHR, textStatus) {
alert( "Request failed: " + textStatus );
});

PHP-Ajax data migration issue

Not able to figure out why my ajax code is not sending the data to the php file. have tried many things but it doesn't seem to work.
can anybody help me out here please.
My html code:
<!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">
<head>
<title>ABC Fashion</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script type = "text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"> </script>
<script>
$(document).ready(function(){
$("button").click(function(){
alert((this).id);
var id=(this).id;
var params ={id : (this).id};
$.post("code.php", params);
alert(1);
});
});
</script>
</head>
<body>
<div id="main_container">
<div class="center_content" align="center">
<div class="center_title_bar" align="center">Latest Products</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Levi's Men's Cotton T-Shirt</div>
<div class="product_img"><img src="images/T1.jpg" name="tshirt" alt="" border="0" id="T1"/></div>
<div class="product_img"><button id="d1" onclick="">Dislike</button></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">UB Stylish T-shirt</div>
<div class="product_img"><img src="images/T2.jpg" name="tshirt" alt="" border="0" id="T2"/></div>
<div class="product_img"><div class="product_img"><button id="d2" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Jacob n John T-Shirt</div>
<div class="product_img"><img src="images/T3.jpg" name="tshirt" alt="" border="0" id="T3"/></div>
<div class="product_img"><div class="product_img"><button id="d3" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Levi's Men's Cotton T-Shirt</div>
<div class="product_img"><img src="images/T4.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d4" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">UB Stylish T-shirt</div>
<div class="product_img"><img src="images/T5.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d5" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Jacob n John T-Shirt</div>
<div class="product_img"><img src="images/T6.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d6" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Levi's Men's Cotton T-Shirt</div>
<div class="product_img"><img src="images/T7.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d7" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">UB Stylish T-shirt</div>
<div class="product_img"><img src="images/T8.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d8" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Jacob n John T-Shirt</div>
<div class="product_img"><img src="images/T9.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d9" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Levi's Men's Cotton T-Shirt</div>
<div class="product_img"><img src="images/T10.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d10" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">UB Stylish T-shirt</div>
<div class="product_img"><img src="images/T11.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d11" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
<div class="prod_box">
<div class="top_prod_box"></div>
<div class="center_prod_box">
<div class="product_title">Jacob n John T-Shirt</div>
<div class="product_img"><img src="images/T12.jpg" alt="" border="0" /></div>
<div class="product_img"><div class="product_img"><button id="d12" onclick="">Dislike</button></div></div>
<div class="prod_price"><span class="reduce">350$</span> <span class="price">270$</span></div>
</div>
<div class="bottom_prod_box"></div>
<div class="prod_details_tab"> <img src="images/cart.gif" alt="" border="0" class="left_bt" /> <img src="images/favs.gif" alt="" border="0" class="left_bt" /> <img src="images/favorites.gif" alt="" border="0" class="left_bt" /> details </div>
</div>
</div>
</body>
</html>
and my php code is as follows:
<?php
$servername = "localhost:3306";
$username = "admin";
$password = "password";
$dbname = "testdb";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_error($conn));
}
$num= (int)$_POST["params"];
$str = $num;
$tempid = substr_replace($str,"T",0);
echo $str;
$sql = "INSERT INTO `test` (`disliked`) VALUES ('$num')";
if (mysqli_query($conn, $sql) === TRUE) {
echo "New record created successfully";
}
else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
mysqli_close($conn);
?>
You have in your code var params ={id : (this).id}; which is wrong. Should be var params ={id : $(this)[0].id}; (And change all instances of (this).id to $(this)[0].id)
And you're passing the id parameter, so on the server side, change $_POST["params"]; to $_POST["id"];
$num= $_POST["params"]; // REMOVE(int) casting, you're doing it on the next line

Few problems at the same time, 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

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