Friday 15 January 2010

How can i increment session value one on first page using php? -


I need to increase session value by one, now only two start up can increase. First page?

Actually I am trying to increase the receipt number in PDF page.

Can anyone help me solve this problem?

Here's my code:

  & lt ;? Php session_start (); // $ _ session ['rid'] = 0; If (($ _ POST ['Register'])) {$ _SESSION ['Raid'] = $ _SESSION ['Raid'] + 1; ("Fpdf / fpdf.php") is required; $ Pdf = new FPDF (); $ Pdf- & gt; Addpage (); $ Pdf- & gt; SetFont ("Aerial", "B", 18); $ Pdf- & gt; Cell (0, 10, "Receipt number:". $ _ Session ['rid'], 0,0, 'C'); $ Pdf- & gt; Production (); }? & Gt;  

Oh, I've got your question now. You can do something like this:

  & lt ;? Php session_start (); If (! Isset ($ _ session ['rid']) $ _ session ['rid'] = 0; If (($ _ POST ['Register'])) {$ _SESSION ['Raid'] = $ _SESSION ['Raid'] + 1; ("Fpdf / fpdf.php") is required; $ Pdf = new FPDF (); $ Pdf- & gt; Addpage (); $ Pdf- & gt; SetFont ("Aerial", "B", 18); $ Pdf- & gt; Cell (0, 10, "Receipt number:". $ _ Session ['rid'], 0,0, 'C'); $ Pdf- & gt; Production (); }? & Gt;  

No comments:

Post a Comment