473,396 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Php Session

samikhan83
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:.....
Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. require_once("../comman/connection.php");
  3. require_once("add_product.php");
  4. $conn=connect();
  5.  
  6.  
  7. if(isset($_POST["txt_upc_code"]))
  8. {
  9.  
  10. //get data from form
  11. $upc_code=trim($_POST["txt_upc_code"]);
  12.  
  13. if (empty($upc_code))
  14.     {
  15.         $errors[] = 'Please Scan OR Enter The Product UPC Barcode';
  16.     }
  17.  
  18.  
  19. if (count($errors) == 0)
  20.     {
  21.  
  22.     if($row=sel_pr_by_upc($upc_code))
  23.     {
  24.         //echo "$row[0]-$row[1]-$row[2]-$row[3]";
  25.         $_SESSION["code"]=$row['p_upc_code'];
  26.         //header('Location:product_entry.php?id='.$row['p_upc_code']);
  27.         header('Location:product_entry.php');
  28.     }
  29.     else
  30.     {
  31.         echo"There Is No Product With This UPC You Have To First Register The Product";
  32.     }
  33.  
  34.   }
  35.  
  36. }
  37.  
  38. ?>
  39.  
  40. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  41. <html xmlns="http://www.w3.org/1999/xhtml">
  42. <head>
  43. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  44. <title><?=$title?></title>
  45. <link href="add_product.css" rel="stylesheet" type="text/css" />
  46. </head>
  47.  
  48. <body onload="javascript:document.getElementById('txt_upc_code').focus()"><div id="container">
  49. <div id="header"><h1>Scan A Product</h1></div>
  50.  
  51. <div id="top_nav">
  52. </div>
  53.  
  54.  
  55. <form id="frm_add_pr_grp" name="frm_add_pr_grp" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
  56.    <span id="back"><a href="javascript:history.go(-1);">back</a></span><p class="mini">Scan A Product</p>
  57.    <span><?=$errors[0]?></span>
  58.   <table>
  59.    <tr>
  60.       <td>UPC Code</td>
  61.       <td><input name="txt_upc_code" type="text" id="txt_upc_code"/></td>
  62.     </tr>
  63.     <tr><td colspan="2"><input name="btn_sub" type="submit" value="Submit"/><input name="btn_clear" type="reset"  value="Clear"/></td></tr>
  64. </table>    
  65.  
  66. </form>
  67. </div>
  68. </body>
  69. </html>
  70.  
Please its URGENT.......

Thanx in Advance
Aug 6 '08 #1
3 1203
pbmods
5,821 Expert 4TB
Heya, Samikhan.

Where do you call session_start()?
Aug 6 '08 #2
hi pbmods
thanx for ur help i forgot to add start_session(); i thought i have added it already in my connection.ini file...

Thank You
Aug 6 '08 #3
pbmods
5,821 Expert 4TB
Glad to be of service. Good luck with your project, and if you ever need anything, post back anytime (:
Aug 6 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Damien | last post by:
Hi to all, I'm currently re-designing our intranet : nice and lean CSS2, cleaned-up PHP 4.3.7, better-normalized MySQL ;o). So I've started using the $_SESSION variable instead of register_globals...
1
by: mudge | last post by:
I'm running PHP Version 4.3.10. I'm trying to make it so that when a person logs in using a user name and password that their session is valid and continues for a few months so they don't have to...
6
by: Al Jones | last post by:
This is a repost form the vbscript newgroup - if this isn't the appropriate group would you point me toward one that is. Basically, I seem to be losing session data part way though preparing an...
5
by: Abhilash.k.m | last post by:
This is regarding the session management using Out of proc session management(SQL SERVER). Among the samples below which one is better to set the session? 1. There are 20 session...
0
by: joseph conrad | last post by:
Hi, I tried to implement my own session handler in order to keep control on the process the drawback I foun it is not creating and storing in my cookie the PHPSESSID variable anymore. reading te...
14
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. For example User A has access to 10 companies and...
7
by: aroraamit81 | last post by:
Well Guys, Here is a very strange trouble. When more than one users request tto same page at the same time then our session gets conflicted. Moreover I printed my SessionID, strangely but true I...
0
by: TRB_NV | last post by:
I'd been using an Access database based shopping cart, but wanted to change it so that it would use session variables. I have a form that's submitted to a page called addtocart.asp that contains...
1
by: Santosh | last post by:
Dear All i am writting a code sending mail with attachement. i am writting code for sending mail in one page and code for attaching a file in the next page. aftet attaching a file i am taking...
5
by: lyealain | last post by:
<% If Session("username") = "" Then Response.Redirect("/CLS/Login.asp") End If Dim conn Dim connectstr Dim db_name, db_username, db_userpassword Dim db_server Dim res
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.