Hello To All this is my first post in this forum.....
i am having a problem with PHP sessions this is first time it giving be trouble.... not getting wat i did wrong......
I am using barcode reader as an input device which according to me should not be related with session...
this is my code:.....
[code=php]
<?php
require_once(". ./comman/connection.php" );
require_once("a dd_product.php" );
$conn=connect() ;
if(isset($_POST["txt_upc_co de"]))
{
//get data from form
$upc_code=trim( $_POST["txt_upc_co de"]);
if (empty($upc_cod e))
{
$errors[] = 'Please Scan OR Enter The Product UPC Barcode';
}
if (count($errors) == 0)
{
if($row=sel_pr_ by_upc($upc_cod e))
{
//echo "$row[0]-$row[1]-$row[2]-$row[3]";
$_SESSION["code"]=$row['p_upc_code'];
//header('Locatio n:product_entry .php?id='.$row['p_upc_code']);
header('Locatio n:product_entry .php');
}
else
{
echo"There Is No Product With This UPC You Have To First Register The Product";
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=$titl e?></title>
<link href="add_produ ct.css" rel="stylesheet " type="text/css" />
</head>
<body onload="javascr ipt:document.ge tElementById('t xt_upc_code').f ocus()"><div id="container" >
<div id="header"><h1 >Scan A Product</h1></div>
<div id="top_nav">
</div>
<form id="frm_add_pr_ grp" name="frm_add_p r_grp" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<span id="back"><a href="javascrip t:history.go(-1);">back</a></span><p class="mini">Sc an A Product</p>
<span><?=$error s[0]?></span>
<table>
<tr>
<td>UPC Code</td>
<td><input name="txt_upc_c ode" type="text" id="txt_upc_cod e"/></td>
</tr>
<tr><td colspan="2"><in put name="btn_sub" type="submit" value="Submit"/><input name="btn_clear " type="reset" value="Clear"/></td></tr>
</table>
</form>
</div>
</body>
</html>
[/code]
Please its URGENT.......
Thanx in Advance
i am having a problem with PHP sessions this is first time it giving be trouble.... not getting wat i did wrong......
I am using barcode reader as an input device which according to me should not be related with session...
this is my code:.....
[code=php]
<?php
require_once(". ./comman/connection.php" );
require_once("a dd_product.php" );
$conn=connect() ;
if(isset($_POST["txt_upc_co de"]))
{
//get data from form
$upc_code=trim( $_POST["txt_upc_co de"]);
if (empty($upc_cod e))
{
$errors[] = 'Please Scan OR Enter The Product UPC Barcode';
}
if (count($errors) == 0)
{
if($row=sel_pr_ by_upc($upc_cod e))
{
//echo "$row[0]-$row[1]-$row[2]-$row[3]";
$_SESSION["code"]=$row['p_upc_code'];
//header('Locatio n:product_entry .php?id='.$row['p_upc_code']);
header('Locatio n:product_entry .php');
}
else
{
echo"There Is No Product With This UPC You Have To First Register The Product";
}
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=$titl e?></title>
<link href="add_produ ct.css" rel="stylesheet " type="text/css" />
</head>
<body onload="javascr ipt:document.ge tElementById('t xt_upc_code').f ocus()"><div id="container" >
<div id="header"><h1 >Scan A Product</h1></div>
<div id="top_nav">
</div>
<form id="frm_add_pr_ grp" name="frm_add_p r_grp" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
<span id="back"><a href="javascrip t:history.go(-1);">back</a></span><p class="mini">Sc an A Product</p>
<span><?=$error s[0]?></span>
<table>
<tr>
<td>UPC Code</td>
<td><input name="txt_upc_c ode" type="text" id="txt_upc_cod e"/></td>
</tr>
<tr><td colspan="2"><in put name="btn_sub" type="submit" value="Submit"/><input name="btn_clear " type="reset" value="Clear"/></td></tr>
</table>
</form>
</div>
</body>
</html>
[/code]
Please its URGENT.......
Thanx in Advance
Comment