Jump to content

Recommended Posts

cart.php

 

<?php
session_start();
error_reporting(E_ALL);
ini_set('display errors','1');
mysql_connect("localhost","root") or die ("could not connect to mysql");
mysql_select_db("pensotech_mystore") or die ("no database"); 
?>
<?php
if(isset($_POST['pid']))
{
$pid=$_POST['pid'];
$wasfound=false;
$i=0;
if(!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"])<1)
{
   $_SESSION["cart_array"]=array(0 => array("item_id" => $pid, "quantity" => 1));	 
}
else
{
  foreach($_SESSION["cart_array"] as $each_item)
  {
   $i++;
   while(list($key,$value)=each($each_item))
   {
if($key=="item_id" && $value==$pid)
{
 array_splice($_SESSION["cart_array"], $i-1,1,array(array("item_id" =>$pid,"quantity" => $each_item['quantity']+1)));
 $wasfound=true;
}
   }
  }
  if($wasfound==false)
  {
   array_push($_SESSION["cart_array"],array("item_id" => $pid, "quantity"=> 1));
  }
}
header("location:cart.php");
exit();
}
?>
<?php
if(isset($_GET['cmd']) && $_GET['cmd']=="emptycart")
{
unset($_SESSION["cart_array"]);
}
?>
<?php
if(isset($_POST['item_to_adjust']) && $_POST['item_to_adjust']!="")
{
   $item_to_adjust=$_POST['item_to_adjust'];	
   $quantity=$_POST['quantity'];	
   $quantity=preg_replace('#[^0-9]#i','',$quantity);
   if($quantity>=100) {$quantity=99;}
   if($quantity<1) {$quantity=1;}
   $i=0;
   foreach($_SESSION["cart_array"] as $each_item)
  {
   $i++;
   while(list($key,$value)=each($each_item))
   {
if($key=="item_id" && $value==$item_to_adjust)
{
 array_splice($_SESSION["cart_array"], $i-1,1,array(array("item_id" =>$item_to_adjust,"quantity" => $quantity)));
}
   }
  }
}
?>
<?php
if(isset($_POST['index_to_remove']) && $_POST['index_to_remove']!="")
{
$key_to_remove=$_POST['index_to_remove'];
if(count($_SESSION["cart_array"]) <= 1)
{
  unset($_SESSION["cart_array"]);
}

else
{
  unset($_SESSION["cart_array"]["$key_to_remove"]);
  sort($_SESSION["cart_array"]);
}
}
?>
<?php
$cartOutput="";
$cartTotal="";
$pp_checkout_btn='';
$product_id_array='';
if(!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1)
{
$cartOutput="<h2 align='center'> Your shopping cart is empty</h2>";
}
else
{
$pp_checkout_btn.='<form action="https://www.paypal.com/cgi-bin/webscr" method="post"
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="you@youremail.com">';	
$i=0;
foreach($_SESSION["cart_array"] as $each_item)
{
  $item_id=$each_item['item_id'];
  $sql=mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1");
  while($row=mysql_fetch_array($sql))
  {
   $product_name=$row["$product_name"];
   $price=$row["$price"];
   $details=$row["$details"];
  }
  $pricetotal=$price*$each_item['quantity'];
  $cartTotal=$pricetotal+ $cartTotal;
  setlocale(LC_MONETARY,"en_US");
  $pricetotal=money_format("%10.2n",$pricetotal);
  $x=$i+1;
  $pp_checkout_btn.='<input type="hidden" name="item_name_' .$x. '" value="' .$product_name. '">
			    <input type="hidden" name="amount_' .$x. '" value="' .$price. '">
					<input type="hidden" name="quantity_' .$x. '" value="' .$each_item['quantity']. '">';
  $product_id_array.="$item_id-" .$each_item['quantity']. ",";
  $cartOutput.="<tr>";
  $cartOutput.='<td><a href="product.php?id=' . $item_id . '">' . $product_name . '</a><br/><img src="inventory_images/' . $item_id . '.jpg" alt="'.$product_name.'" width="40" height="52" border="1"/> </td>';
  $cartOutput.='<td>'.$details.'</td>';
  $cartOutput.='<td>RM'.$price.'</td>';
  $cartOutput.='<td>form action="cart.php" method="post">
  <input name="quantity" type="text" value="'.$each_item['quantity'].'" size="1" maxlength="2" />
  <input name="adjustBtn' . $item_id . '" type="submit" value="change" />
  <input name="item_to_adjust" type="hidden" value="' . $item_id . '" /></form></td>';
  //$cartOutput .='<td>'.$each_item['quantity'].'</td>';
  $cartOutput.='<td>RM'.$pricetotal.'</td>';
  $cartOutput.='<td><form action="cart.php" method="post"><input name="deleteBtn' . $item_id . '" type="submit" value="X" /><input name="index_to_remove" type="hidden" value="' . $item_id . '" /></form></td>';
  $cartOutput.='</tr>';
  $i++;
}
setlocale(LC_MONETARY,"en_US");
$cartTotal=money_format("%10.2n",$cartTotal);
$cartTotal="<div style='font-size:18px; margin-top:12px;' align='right'>Cart Total: RM".$cartTotal."</div>";
$pp_checkout_btn.='<input type="hidden" name="custom" value="' .$product_id_array. '">
					<input type="hidden" name="notify_url" value="my_ipn.php">
			    <input type="hidden" name="return" value="checkout_complete.php">
					<input type="hidden" name="rm" value="2">
				<input type="hidden" name="cbt" value="Return to The Store">
			    <input type="hidden" name="cancel_return" value="paypal_cancel.php">
					<input type="hidden" name="lc" value="US">
				<input type="hidden" name="currency_code" value="USD">
				<input type="image src="http://www.paypal.com/en_US/i/btn/x-click-but01.gif" name="submit" alt="Make payments with PayPal - its                                            fast and secure!">
				</form>';
}
?>
<!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>Your Cart</title>
<link rel="stylesheet" href="style/style.css" type="text/css" media="screen"/>
</head>
<body>
<div align="center" id="mainWrapper">
<?php include_once("template_header.php");?>
<div id="pageContent">
<div style="margin:24px; text-align:left;">
  
  <table width="100%" border="1" cellspacing="0" cellpadding="6">
    <tr>
      <td width="13%" bgcolor="#66FFCC"><strong>Product</strong></td>
      <td width="50%" bgcolor="#66FFCC"><strong>Product Description</strong></td>
      <td width="10%" bgcolor="#66FFCC"><strong>Unit Price</strong></td>
      <td width="8%" bgcolor="#66FFCC"><strong>Quantity</strong></td>
      <td width="6%" bgcolor="#66FFCC"><strong>Total</strong></td>
      <td width="13%" bgcolor="#66FFCC"><strong>Remove</strong></td>
    </tr>
    <?php echo $cartOutput;?>
   <!-- <tr>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
    </tr> -->
  </table>
  <?php echo $cartTotal;?><br/><br/>
  <?php // echo $pp_checkout_btn; ?>
  <p><br />
    <br />
    <a href="cart.php?cmd=emptycart">Click Here To Empty Your Shopping Cart</a></p>
</div>
<br /></div>
<?php include_once("template_footer.php");?>
</div>
</body>
</html>

 

I got this error

 

Notice: Undefined variable: product_name in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 107

 

Notice: Undefined index: in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 107

 

Notice: Undefined variable: price in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 108

 

Notice: Undefined index: in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 108

 

Notice: Undefined variable: details in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 109

 

Notice: Undefined index: in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 109

 

Fatal error: Call to undefined function money_format() in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 114

 

 

Any solution help me please :)

Link to comment
https://forums.phpfreaks.com/topic/263889-cartphp-error/
Share on other sites

If the money_format function is undefined in your version of php, you have an extremely old version of php and need to upgrade it. It's also possible that you typed that function name using foreign language characters (the copy/paste to the forum post converted them to plain ascii) and you need to delete and retype the function name.

Link to comment
https://forums.phpfreaks.com/topic/263889-cartphp-error/#findComment-1352542
Share on other sites

The errors are pretty self explanatory. What part exactly are you having trouble with?

 

 

Notice: Undefined variable: product_name in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 107

 

Notice: Undefined index: in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 107

 

Notice: Undefined variable: price in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 108

 

Notice: Undefined index: in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 108

 

Notice: Undefined variable: details in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 109

 

Notice: Undefined index: in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 109

 

 

i got this error and still im did not get it or my arrangement is not properly well because too many <php tag

Link to comment
https://forums.phpfreaks.com/topic/263889-cartphp-error/#findComment-1352606
Share on other sites

If the money_format() function is undefined in your version of php, you have an extremely old version of php and need to upgrade it.

 

He is running Windows and per the manual:

The function money_format() is only defined if the system has strfmon capabilities. For example, Windows does not, so money_format() is undefined in Windows.

 

You can try this function that you can find on the manual page as a replacement:

http://be2.php.net/manual/en/function.money-format.php#89060

function money_format($format, $number) 
{ 
    $regex  = '/%((?:[\^!\-]|\+|\(|\=.)*)([0-9]+)?'. 
              '(?:#([0-9]+))?(?:\.([0-9]+))?([in%])/'; 
    if (setlocale(LC_MONETARY, 0) == 'C') { 
        setlocale(LC_MONETARY, ''); 
    } 
    $locale = localeconv(); 
    preg_match_all($regex, $format, $matches, PREG_SET_ORDER); 
    foreach ($matches as $fmatch) { 
        $value = floatval($number); 
        $flags = array( 
            'fillchar'  => preg_match('/\=(.)/', $fmatch[1], $match) ? 
                           $match[1] : ' ', 
            'nogroup'   => preg_match('/\^/', $fmatch[1]) > 0, 
            'usesignal' => preg_match('/\+|\(/', $fmatch[1], $match) ? 
                           $match[0] : '+', 
            'nosimbol'  => preg_match('/\!/', $fmatch[1]) > 0, 
            'isleft'    => preg_match('/\-/', $fmatch[1]) > 0 
        ); 
        $width      = trim($fmatch[2]) ? (int)$fmatch[2] : 0; 
        $left       = trim($fmatch[3]) ? (int)$fmatch[3] : 0; 
        $right      = trim($fmatch[4]) ? (int)$fmatch[4] : $locale['int_frac_digits']; 
        $conversion = $fmatch[5]; 

        $positive = true; 
        if ($value < 0) { 
            $positive = false; 
            $value  *= -1; 
        } 
        $letter = $positive ? 'p' : 'n'; 

        $prefix = $suffix = $cprefix = $csuffix = $signal = ''; 

        $signal = $positive ? $locale['positive_sign'] : $locale['negative_sign']; 
        switch (true) { 
            case $locale["{$letter}_sign_posn"] == 1 && $flags['usesignal'] == '+': 
                $prefix = $signal; 
                break; 
            case $locale["{$letter}_sign_posn"] == 2 && $flags['usesignal'] == '+': 
                $suffix = $signal; 
                break; 
            case $locale["{$letter}_sign_posn"] == 3 && $flags['usesignal'] == '+': 
                $cprefix = $signal; 
                break; 
            case $locale["{$letter}_sign_posn"] == 4 && $flags['usesignal'] == '+': 
                $csuffix = $signal; 
                break; 
            case $flags['usesignal'] == '(': 
            case $locale["{$letter}_sign_posn"] == 0: 
                $prefix = '('; 
                $suffix = ')'; 
                break; 
        } 
        if (!$flags['nosimbol']) { 
            $currency = $cprefix . 
                        ($conversion == 'i' ? $locale['int_curr_symbol'] : $locale['currency_symbol']) . 
                        $csuffix; 
        } else { 
            $currency = ''; 
        } 
        $space  = $locale["{$letter}_sep_by_space"] ? ' ' : ''; 

        $value = number_format($value, $right, $locale['mon_decimal_point'], 
                 $flags['nogroup'] ? '' : $locale['mon_thousands_sep']); 
        $value = @explode($locale['mon_decimal_point'], $value); 

        $n = strlen($prefix) + strlen($currency) + strlen($value[0]); 
        if ($left > 0 && $left > $n) { 
            $value[0] = str_repeat($flags['fillchar'], $left - $n) . $value[0]; 
        } 
        $value = implode($locale['mon_decimal_point'], $value); 
        if ($locale["{$letter}_cs_precedes"]) { 
            $value = $prefix . $currency . $space . $value . $suffix; 
        } else { 
            $value = $prefix . $value . $space . $currency . $suffix; 
        } 
        if ($width > 0) { 
            $value = str_pad($value, $width, $flags['fillchar'], $flags['isleft'] ? 
                     STR_PAD_RIGHT : STR_PAD_LEFT); 
        } 

        $format = str_replace($fmatch[0], $value, $format); 
    } 
    return $format; 
}

 

 

Link to comment
https://forums.phpfreaks.com/topic/263889-cartphp-error/#findComment-1352614
Share on other sites

The function money_format() is only defined if the system has strfmon capabilities. For example, Windows does not, so money_format() is undefined in Windows.

 

LOL.

 

i got this error and still im did not get it ...

 

In your June 06 thread, you were correctly referencing the product_name and price data from your query. I suggest you look at the lines of code where you are getting the current errors and compare them with the similar lines of code in your June 06 thread.

 

 

Link to comment
https://forums.phpfreaks.com/topic/263889-cartphp-error/#findComment-1352638
Share on other sites

The function money_format() is only defined if the system has strfmon capabilities. For example, Windows does not, so money_format() is undefined in Windows.

 

LOL

 

Care to elaborate? I am running PHP 5.4 under Windows and trying to use the money_format() function returns:

PHP Fatal error:  Call to undefined function money_format() in Command line code on line 1

 

Which is the same error as the OP while you stated it was due to an old version of PHP, which it is not.

If the money_format() function is undefined in your version of php, you have an extremely old version of php and need to upgrade it.
Link to comment
https://forums.phpfreaks.com/topic/263889-cartphp-error/#findComment-1352670
Share on other sites

<?php
session_start();
error_reporting(E_ALL);
ini_set('display errors','1');
?>
<?php
mysql_connect("localhost","root") or die ("could not connect to mysql");
mysql_select_db("pensotech_mystore") or die ("no database"); 
if(isset($_POST['pid']))
{
$pid=$_POST['pid'];
$wasfound=false;
$i=0;
if(!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"])<1)
{
   $_SESSION["cart_array"]=array(0 => array("item_id" => $pid, "quantity" => 1));	 
}
else
{
  foreach($_SESSION["cart_array"] as $each_item)
  {
   $i++;
   while(list($key,$value)=each($each_item))
   {
if($key=="item_id" && $value==$pid)
{
 array_splice($_SESSION["cart_array"], $i-1,1,array(array("item_id" =>$pid,"quantity" => $each_item['quantity']+1)));
 $wasfound=true;
}
   }
   }
   if($wasfound==false)
   {
   array_push($_SESSION["cart_array"],array("item_id" => $pid, "quantity"=> 1));
   }
  }
}
?>
<?php
if(isset($_GET['cmd']) && $_GET['cmd']=="emptycart")
{
unset($_SESSION["cart_array"]);
}
?>
<?php
$cartOutput="";
if(!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1)
{
$cartOutput="<h2 align='center'> Your shopping cart is empty</h2>";
}
else
{
$i=0;	
foreach($_SESSION["cart_array"] as $each_item)
{	
  $i++;
  $item_id=$each_item['item_id'];
  $sql=mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1");
  while($row=mysql_fetch_array($sql))
  {
   $product_name=$row["$product_name"];
   $price=$row["$price"];
   
  $cartOutput.= "<h2>Cart Item $i</h2>";
  $cartOutput.="Item ID:".$each_item['item_id']."<br />";
  $cartOutput.="Item Quantity:".$each_item['quantity']."<br />";
  $cartOutput.="Item Name:".$product_name."<br />";
  $cartOutput.="Item Price:".$price."<br />";
  }
// while(list($key,$value)=each($each_item))
//  {
//  $cartOutput.="$key:$value<br />";
  
  //}
}
}
?>
<!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>Your Cart</title>
<link rel="stylesheet" href="style/style.css" type="text/css" media="screen"/>
</head>
<body>
<div align="center" id="mainWrapper">
<?php include_once("template_header.php");?>
<div id="pageContent">
<div style="margin:24px; text-align:left;">
  
  <table width="100%" border="1" cellspacing="0" cellpadding="6">
    <tr>
      <td width="13%" bgcolor="#66FFCC"><strong>Product</strong></td>
      <td width="50%" bgcolor="#66FFCC"><strong>Product Description</strong></td>
      <td width="10%" bgcolor="#66FFCC"><strong>Unit Price</strong></td>
      <td width="8%" bgcolor="#66FFCC"><strong>Quantity</strong></td>
      <td width="6%" bgcolor="#66FFCC"><strong>Total</strong></td>
      <td width="13%" bgcolor="#66FFCC"><strong>Remove</strong></td>
    </tr>
    <?php echo $cartOutput;?>
   <!-- <tr>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
    </tr> -->
  </table>
  <?php echo $cartTotal;?><br/><br/>
  <?php // echo $pp_checkout_btn; ?>
  <p><br />
    <br />
    <a href="cart.php?cmd=emptycart">Click Here To Empty Your Shopping Cart</a></p>
</div>
<br /></div>
<?php include_once("template_footer.php");?>
</div>
</body>
</html>

 

I got this error

 

Notice: Undefined variable: product_name in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 61

 

Notice: Undefined index: in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 61

 

Notice: Undefined variable: price in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 62

 

Notice: Undefined index: in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 62

 

Notice: Undefined index: in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 61

 

Notice: Undefined index: in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 62

 

while($row=mysql_fetch_array($sql))

  {

  $product_name=$row["$product_name"];

  $price=$row["$price"];

 

  $cartOutput.= "<h2>Cart Item $i</h2>";

  $cartOutput.="Item ID:".$each_item['item_id']."<br />";

  $cartOutput.="Item Quantity:".$each_item['quantity']."<br />";

  $cartOutput.="Item Name:".$product_name."<br />";

  $cartOutput.="Item Price:".$price."<br />";

  }

 

How  to modify this code? any suggestion ? please help me

Link to comment
https://forums.phpfreaks.com/topic/263889-cartphp-error/#findComment-1354339
Share on other sites

<?php
session_start();
error_reporting(E_ALL);
ini_set('display errors','1');
?>
<?php
mysql_connect("localhost","root") or die ("could not connect to mysql");
mysql_select_db("pensotech_mystore") or die ("no database"); 
if(isset($_POST['pid']))
{
$pid=$_POST['pid'];
$wasfound=false;
$i=0;
if(!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"])<1)
{
   $_SESSION["cart_array"]=array(0 => array("item_id" => $pid, "quantity" => 1));	 
}
else
{
  foreach($_SESSION["cart_array"] as $each_item)
  {
   $i++;
   while(list($key,$value)=each($each_item))
   {
if($key=="item_id" && $value==$pid)
{
 array_splice($_SESSION["cart_array"], $i-1,1,array(array("item_id" =>$pid,"quantity" => $each_item['quantity']+1)));
 $wasfound=true;
}
   }
   }
   if($wasfound==false)
   {
   array_push($_SESSION["cart_array"],array("item_id" => $pid, "quantity"=> 1));
   }
  }
}
?>
<?php
if(isset($_GET['cmd']) && $_GET['cmd']=="emptycart")
{
unset($_SESSION["cart_array"]);
}
?>
<?php
$cartOutput="";
if(!isset($_SESSION["cart_array"]) || count($_SESSION["cart_array"]) < 1)
{
$cartOutput="<h2 align='center'> Your shopping cart is empty</h2>";
}
else
{
$i=0;	
foreach($_SESSION["cart_array"] as $each_item)
{	
  $i++;
  $item_id=$each_item['item_id'];
  $sql=mysql_query("SELECT * FROM products WHERE id='$item_id' LIMIT 1");
  while($row=mysql_fetch_array($sql))
  {
   $product_name=$row['$product_name'];
   $price=$row['$price'];
   
  $cartOutput.= "<h2>Cart Item $i</h2>";
  $cartOutput.="Item ID:".$each_item['item_id']."<br />";
  $cartOutput.="Item Quantity:".$each_item['quantity']."<br />";
  $cartOutput.="Item Name:".$product_name."<br />";
  $cartOutput.="Item Price:".$price."<br />";
  }
// while(list($key,$value)=each($each_item))
//  {
//  $cartOutput.="$key:$value<br />";
  
  //}
}
}
?>
<!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>Your Cart</title>
<link rel="stylesheet" href="style/style.css" type="text/css" media="screen"/>
</head>
<body>
<div align="center" id="mainWrapper">
<?php include_once("template_header.php");?>
<div id="pageContent">
<div style="margin:24px; text-align:left;">
  
  <table width="100%" border="1" cellspacing="0" cellpadding="6">
    <tr>
      <td width="13%" bgcolor="#66FFCC"><strong>Product</strong></td>
      <td width="50%" bgcolor="#66FFCC"><strong>Product Description</strong></td>
      <td width="10%" bgcolor="#66FFCC"><strong>Unit Price</strong></td>
      <td width="8%" bgcolor="#66FFCC"><strong>Quantity</strong></td>
      <td width="6%" bgcolor="#66FFCC"><strong>Total</strong></td>
      <td width="13%" bgcolor="#66FFCC"><strong>Remove</strong></td>
    </tr>
    <?php echo $cartOutput;?>
   <!-- <tr>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
      <td> </td>
    </tr> -->
  </table>
  <?php echo $cartTotal;?><br/><br/>
  <?php // echo $pp_checkout_btn; ?>
  <p><br />
    <br />
    <a href="cart.php?cmd=emptycart">Click Here To Empty Your Shopping Cart</a></p>
</div>
<br /></div>
<?php include_once("template_footer.php");?>
</div>
</body>
</html>

 

 

Notice: Undefined index: $product_name in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 61

 

Notice: Undefined index: $price in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 62

 

Notice: Undefined index: $product_name in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 61

 

Notice: Undefined index: $price in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 62

 

Notice: Undefined index: $product_name in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 61

 

Notice: Undefined index: $price in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 62

 

Still same after i put the single quote any solution?

Link to comment
https://forums.phpfreaks.com/topic/263889-cartphp-error/#findComment-1354369
Share on other sites

Notice: Undefined index: $product_name in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 61

 

Notice: Undefined index: $price in C:\xampp\htdocs\Pensotech Cart System\cart.php on line 62

 

now only this error before that im did not close my browser that why got 4 errors now only left this two error any solution?

Link to comment
https://forums.phpfreaks.com/topic/263889-cartphp-error/#findComment-1354376
Share on other sites

$product_name=$row['$product_name'];
   $price=$row['$price'];

 

now i got the error as im too focus on php error until i forgot what my database row field name where the correct one is $row['product name'] and

$row['price']

 

Simple error even im cannot find sorry for this anyhow matter solved thank you

Link to comment
https://forums.phpfreaks.com/topic/263889-cartphp-error/#findComment-1354394
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.