Thread: Pos
View Single Post
Old 11-04-2012, 01:39 AM   PM User | #3
searls03
New Coder

 
Join Date: Jun 2011
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
searls03 is an unknown quantity at this point
PHP Code:
this is the code that I have:
[PHP]<?php
session_start
(); 
require_once 
"connect.php";
 

    
if(isset(
$_SESSION['logged'])){
    
// Query member data from the database and ready it for display

$cid $_SESSION['complete'];  
 
$academy $_SESSION['academy']; 
 if(
$academy=="Old_Cheney"){$city"Lincoln";}else if($academy=="Yankee_Hill"){$city"Lincoln";}else if($academy=="Holdrege"){$city"Lincoln";}else if($academy=="Maple"){$city"Omaha";}
 else if(
$academy=="Center"){$city"Omaha";}
 else if(
$academy=="Pensacola"){$city"Pensacola";}
$sql mysql_query("SELECT * FROM login where academy ='$academy'");
while(
$row mysql_fetch_array($sql)){
$date =$row["date"];
if (
$date !=="".date('m-d-Y')){echo '<meta http-equiv="REFRESH" content="0;url=login.php">';
   exit(); }
   

}
}else{
echo 
'<meta http-equiv="REFRESH" content="0;url=login.php">';
   exit(); 
}
if(
$academy=='all'){echo '<meta http-equiv="REFRESH" content="0;url=dashboard.php">';}


echo 
$cid;

echo 
$academy;
echo 
$city;

?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>

<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script><script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>

<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script>
<script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $(".empty").validate({
            debug: false,
            
            submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('empty.php', $(".empty").serialize(), function(data) {
                $("#total").load("index.php #total");    $("#txtHint").load("index.php #txtHint");
                });
            }
        });
    });
    </script>
   
<?php
// Query member data from the database and ready it for display
$sql mysql_query("SELECT * FROM cart where academy ='$academy' && cart_id = '".$cid."' ");
while(
$row mysql_fetch_array($sql)){
$id =$row["id"];

?>

    <script type="text/javascript">
    $(document).ready(function(){
        $("#delete<?php echo $id?>").validate({
            debug: false,
            
            submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('delete.php', $("#delete<?php echo $id;?>").serialize(), function(data) {
                                    $("#total").load("index.php #total");
    $("#txtHint").load("index.php #txtHint");
                });
            }
        });
    });
    </script>
    <script type="text/javascript">
    $(document).ready(function(){
        $(".delete<?php echo $id2?>").validate({
            debug: false,
            
            submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('delete.php', $(".delete<?php echo $id2;?>").serialize(), function(data) {
                    $("#total").load("index.php #total");$("#txtHint").load("index.php #txtHint");
                    
                });
            }
        });
    });
    </script>
   
    <?php
}
?>
    <?php
// Query member data from the database and ready it for display
$sql mysql_query("SELECT * FROM products");
while(
$row mysql_fetch_array($sql)){
$id =$row["id"];
?>
  <script type="text/javascript">
    $(document).ready(function(){
        $(".myform<?php echo $id?>").validate({
            debug: false,
            
            submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('process.php', $(".myform<?php echo $id;?>").serialize(), function(data) {
                $("#total").load("index.php #total");    $("#txtHint").load("index.php #txtHint");
                });
            }
        });
    });
    </script> 
  

<?php

}
?>
  <script type="text/javascript">
    $(document).ready(function(){
        $("#myfor").validate({
            debug: false,
            
            submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('process.php', $("#myfor").serialize(), function(data) {
                $("#total").load("index.php #total");    $("#txtHint").load("index.php #txtHint");
                });
            }
        });
    });
    </script> 
    


<link rel="stylesheet" href="chosen/chosen.css" />
  <script>
function update_data(){
// set up a point to the iFrame
var ifrm=document.getElementById('frame1');
ifrm.setAttribute('src', 'load_data.php');
document.getElementById('test123').value = document.getElementById('test123').value;
document.getElementById('price_text').value = document.getElementById('price').value;
document.getElementById('total_text').value = document.getElementById('total').value;

// the product_txtbox would be where you want the product to be place on your page, etc.
</script>
    
    <link href="SpryAssets/SpryTabbedPanels.css" rel="stylesheet" type="text/css" />
</head>

<body leftmargin="0">

<div class="container"> <a href="admin.php">Admin Panel</a> | <a href="void.php">Void Sale</a> | <a href="run.php">Balance the Drawer</a>  | <a href="logout.php">Logout</a><br /><form action="check.php" method="POST" name="" class="">
    <input name="cart_id" type="hidden" value="<?php echo $cid?>" /></form>  
  <div id="test123">
</div>

  <div id="container">
    <div class="side-by-side clearfix">
      <div> 
        <script type="text/javascript">
    $(document).ready(function submit(){
        $(".product").validate({
            debug: false,
            
            submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('process1.php', $(".product").serialize(), function(data) {
                    $("#price").load("index.php #price");
                    $("#total").load("index.php #total");
                });
            }
        });
    });
    </script>
 
        

    </div>
  </div>
    

  
  <script src="chosen/chosen.jquery.js" type="text/javascript"></script>
  <script type="text/javascript"> $(".chzn-select").chosen(); $(".chzn-select-deselect").chosen({allow_single_deselect:true}); </script>
  <div id="txtHint"> 
     

    <script type="text/javascript">
function showUser(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","load_data.php?q="+str,true);
xmlhttp.send();
$("#total").load("index.php #total");
                    $("#txtHint").load("index.php #txtHint");

}
                    

</script>
</head>
    <script type="text/javascript">
    $(document).ready(function(){
        $(".update<?php echo $id 1?>").validate({
            debug: false,
            
            submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('update.php', $(".update<?php echo $id 1;?>").serialize(), function(data) {
                    
                    $("#total").load("index.php #total");
                });
            }
        });
    });
    </script>
    <script type="text/javascript">
function submitForm(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","delete_data.php?q="+str,true);
xmlhttp.send();
$("#total").load("index.php #total");
                    $("#txtHint").load("index.php #txtHint");

}
                    

</script>
       <script type="text/javascript">
function update(str,dat,dat2,disc)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","update.php?q="+str+"&price="+dat2+"&qty="+dat+"&discount="+disc,true);xmlhttp.send();
$("#total").load("index.php #total");
$("#txtHint").load("index.php #txtHint");
$("#total").load("index.php #total");
$("#total").load("index.php #total");


}
                    

</script>
<script type="text/javascript">
function price(str)
{
if (str=="")
  {
  document.getElementById("txtHint").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","update1.php?q="+str+"&price="+document.getElementById.('price1234'),true);xmlhttp.send();
$("#total").load("index.php #total");
$("#txtHint").load("index.php #txtHint");

}
                    

</script>

     
      <?php
// Query member data from the database and ready it for display
$sql mysql_query("SELECT * FROM cart where academy = '".$academy."' && cart_id = '".$cid."' order by id DESC");
while(
$row4 mysql_fetch_array($sql)){
$product $row4["product123"];
$price1 $row4["price"];
$id $row4["id"];
$qty $row4["quantity"];
if(
$product !=""){



?>

  
  <form name="delete" class="delete" method="POST" action=""> 
<button onClick="submitForm(<?php echo $id?>);return false"><img src="pics/x.jpg" height="59" style="height:25px; width:40px;"></button>
  <input type="hidden" name="hiddenField" value="<?php echo $id?>" />
  
  <?php  echo $product;
?>
</form>
<div id="name">

<form action="" class="update<?php echo $id?>" method="POST">
  
  <input name="id" type="hidden" value="<?php echo $id?>" />
    Quantity 
    <input name="qty" id="qty" type="text" value="<?php echo $qty?>" size="2" />$<input name="price1234" id="price1234"  type="text" value="<?php echo $price1?>" size="6" />Discount:<input name="discount" id="discount"  type="text" value="" size="6" />
    % off (format of 00, eg. 04)
    
    <input type="button" name="submit" value="update" onclick="update(<?php echo $id?>,qty.value,price1234.value,discount.value)" />
</form><hr /></div>


    <?php
    $price1 
$price1 $qty;
$total =  $price1 $total;
?>
<?php
}}
?>
      <br />
 
</div> <?php
// Query member data from the database and ready it for display
$sql mysql_query("SELECT * FROM products");
while(
$row5 mysql_fetch_array($sql)){
$product $row5["product"];
$id =$row5["id"];
$price =$row5["price"];

?>

<?php

}
?>  <div>
 <form action="" method="POST" name="empty" class="empty"> 

    <input name="cart_id" type="hidden" value="<?php echo $cid?>" /><input type="submit" name="empty" class="submit" value="empty cart" style="background-color:lightgreen; height:50px; width:100px;left:0px;" onclick="reload();">   </form> </div> <div>
   <form class="product" action="index.php" name="form12345" method="POST">
   </form>
   </div>
<script src="chosen/chosen.jquery.js" type="text/javascript"></script>
<script type="text/javascript"> $(".chzn-select").chosen(); $(".chzn-select-deselect").chosen({allow_single_deselect:true}); </script>
 <div id="total"><form name="pay" class="pay" method="POST" action="collect.php?total=<?php echo $total?>"> 
   <p>
     <?php if ($total == ""){$total "0";} ?>
     <?php setlocale(LC_MONETARY"en_US");
echo 
money_format("%n"$total);?>
     <?php
// Query member data from the database and ready it for display
$sql mysql_query("SELECT * FROM cart where cart_id = '".$_SESSION['cart_id']."' && academy= '$academy' && product123 !=''");
while(
$row mysql_fetch_array($sql)){
$product $row["product123"];
$price1 $row["price"];
$id $row["product_id"];
$qty $row["quantity"];



$month date("F Y"); 
$day date("d"); 
$year date("Y"); 
$date date("Y-m-d");
?>
     <input name="product[]" type="hidden" value="<?php echo $product?>" /><input name="academy[]" type="hidden" value="<?php echo $academy?>" /><input name="month[]" type="hidden" value="<?php echo $month?>" /><input name="day[]" type="hidden" value="<?php echo $day?>" /><input name="year[]" type="hidden" value="<?php echo $year?>" /><input name="date[]" type="hidden" value="<?php echo $date?>" /><input name="price[]" type="hidden" value="<?php echo $price1?>" /><input name="id[]" type="hidden" value="<?php echo $id?>" />
  <input name="qty[]" type="hidden" value="<?php echo $qty?>" /><?php
}
?> 
  <?php if ($total == " "){$total "0";} ?>
  <input type="hidden" value="<?php echo $total?>" name="total" />
<input type="submit" name="pay" id="pay" class="pay1" value="" />
 </form><br />
 
</div> 




<div id="TabbedPanels2" class="TabbedPanels">
  <ul class="TabbedPanelsTabGroup">
    <li class="TabbedPanelsTab" tabindex="0">Retail<br />
      <br />
      <br />
    </li>
    <li class="TabbedPanelsTab" tabindex="0">Trial Course<br />
      <br />
      <br />
    </li>
    <li class="TabbedPanelsTab" tabindex="0">Testing<br />
      <br />
      <br />
    </li>
    <li class="TabbedPanelsTab" tabindex="0">Events<br />
      <br />
      <br />
    </li>
    <li class="TabbedPanelsTab" tabindex="0">Birthday<br />
Parties<br />
      <br />
    </li>
    <li class="TabbedPanelsTab" tabindex="0">Enrollment <br />
      Fee<br />
      <br />
    </li>
    <li class="TabbedPanelsTab" tabindex="0">Memberships<br />
      <br />
      <br />
    </li>
    <li class="TabbedPanelsTab" tabindex="0">Packages<br />
      <br />
      <br />
  </li>
    <li class="TabbedPanelsTab" tabindex="0">Private<br />
lessons<br />
      <br />
    </li>
    <li class="TabbedPanelsTab" tabindex="0">Championships<br />
      <br />
      <br />
    </li>
</ul>
  <div class="TabbedPanelsContentGroup">
    <div class="TabbedPanelsContent"><div id="TabbedPanels3" class="TabbedPanels">
        <ul class="TabbedPanelsTabGroup">
          <li class="TabbedPanelsTab" style="background-color: #0CF;" tabindex="0">Main Retail<br />
            <br />
          </li>
          <li class="TabbedPanelsTab"  style="background-color: #0CF;"tabindex="0">Sparring/Ecas Gear<br />
            <br />
          </li>
          <li class="TabbedPanelsTab"  style="background-color: #0CF;" tabindex="0">Uniforms<br />
            <br />
          </li>
          <li class="TabbedPanelsTab"  style="background-color: #0CF;" tabindex="0">Manuals<br />
            <br />
          </li>
          <li class="TabbedPanelsTab"  style="background-color: #0CF;" tabindex="0">Patches<br />
            <br />
          </li>
        </ul>
        <div class="TabbedPanelsContentGroup">
          <div class="TabbedPanelsContent"> <?php
         
$sql 
mysql_query("SELECT * FROM products where category='retail' and subcategory='Main Retail' and city='$city'");
  
$i 0;
    echo 
"
    <table width='50%' cellpadding='0px' cellspacing='0px'><tr>"
;

        while(
$row mysql_fetch_assoc($sql)){
$product $row["product"];
$id =$row["id"];
$price =$row["price"];
$text $product;
$newtext wordwrap($text14);
$final1 ="".$newtext."
$"
.$price."";
 

echo 
"<td>";
?>

      
    

 <form action="" method="POST" name="myform<?php echo $id?>" class="myform<?php echo $id?>"> 
        <input type="hidden" name="hiddenField" class="hiddenField" value="<?php echo $product?>" />
        <input type="hidden" name="hiddenField2" class="hiddenField2" value="<?php echo $id?>" />
        <input type="hidden" name="hiddenField1" class="hiddenField1" value="<?php echo $price?>" />
      <input type="submit" name="submit" class="submit" value="<?php echo $final1?>" style="left: 0px; background-color:lightgreen; height:70px; width:100px;" onclick="update_data();">   </form>
<?php

echo "</td>";
if (
$i && $i%== 5) echo '</tr><tr>';
      
$i++;
    }
    
    echo 
"</table> ";
    
?>


     
</div>
          <div class="TabbedPanelsContent">
            <?php
         
$sql 
mysql_query("SELECT * FROM products where category='retail' and subcategory='Sparring/ECAS Gear' and city='$city'");
  
$i 0;
    echo 
"
    <table width='50%' cellpadding='0px' cellspacing='0px'><tr>"
;

        while(
$row mysql_fetch_assoc($sql)){
$product $row["product"];
$id =$row["id"];
$price =$row["price"];
$text $product;
$newtext wordwrap($text14);
$final1 ="".$newtext."
$"
.$price."";
 

echo 
"<td>";
?>

      
    

   
 <form action="" method="POST" name="myform<?php echo $id?>" class="myform<?php echo $id?>"> 
        <input type="hidden" name="hiddenField" class="hiddenField" value="<?php echo $product?>" />
        <input type="hidden" name="hiddenField2" class="hiddenField2" value="<?php echo $id?>" />
        <input type="hidden" name="hiddenField1" class="hiddenField1" value="<?php echo $price?>" />
      <input type="submit" name="submit" class="submit" value="<?php echo $final1?>" style="background-color:lightgreen; height:70px; width:120px;" onclick="reload();">   </form>
<?php
echo "</td>";
if (
$i && $i%== 4) echo '</tr><tr>';
      
$i++;
    }
    
    echo 
"</table> ";
    
?>

          </div>
          <div class="TabbedPanelsContent"> <?php
         
$sql 
mysql_query("SELECT * FROM products where category='retail' and subcategory='Uniforms' and city='$city'");
  
$i 0;
    echo 
"
    <table width='50%' cellpadding='0px' cellspacing='0px'><tr>"
;

        while(
$row mysql_fetch_assoc($sql)){
$product $row["product"];
$id =$row["id"];
$price =$row["price"];
$text $product;
$newtext wordwrap($text14);
$final1 ="".$newtext."
$"
.$price."";
 

echo 
"<td>";
?>

      
    

   

<p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
<!-- end .content --></div>
 
<!-- end .container --></div>

<script type="text/javascript">
var TabbedPanels2 = new Spry.Widget.TabbedPanels("TabbedPanels2");
var TabbedPanels3 = new Spry.Widget.TabbedPanels("TabbedPanels3");
</script>

</body>
</html>
[/PHP]It just goes on like this for awhile then....hopefully you can help me out (sorry for so much code lol)

Last edited by searls03; 11-04-2012 at 01:41 AM..
searls03 is offline   Reply With Quote