Sessions 2

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nico

    Sessions 2

    Hello,

    I tried to upload in my website the following trial php file:

    <FORM METHOD="POST" ACTION="prova.p hp">
    <b>Combinatio n</b><br><br>
    Element 1: <INPUT NAME="el1" TYPE="TEXT">
    <BR>
    Element 2: <INPUT NAME="el2" TYPE="TEXT">
    <br>
    <INPUT TYPE="SUBMIT" VALUE"Submit">
    </FORM>
    <br>
    Combination<br> <br>
    <?php

    session_start() ;
    $_SESSION["combinatio ns"][] = ($_REQUEST["el1"].$_REQUEST["el2"]);
    print_r($_SESSI ON["combinatio ns"]);
    ?>

    As result, I obtain the following error:

    Warning: session_start() [function.sessio n-start]: Cannot send session
    cookie - headers already sent by (output started at
    /home/httpd/docs/prova.php:12) in /home/httpd/docs/prova.php on line 13

    Warning: session_start() [function.sessio n-start]: Cannot send session
    cache limiter - headers already sent (output started at
    /home/httpd/docs/prova.php:12) in /home/httpd/docs/prova.php on line 13

    Sessions don't work.
    Can you help me to understand which is the problem and how can I solve
    it please?
    Many thanks.

    Cheers,
    Nico
  • theCancerus

    #2
    Re: Sessions 2

    hello nico,

    this error comes when you send anything to browser before starting
    session. this happens with any header function you may use. to solve
    this you must put "session_start( )" at the start of php the page as i
    had shown you in your the previous post.

    this will solve your problem.

    cheers
    Amit

    On Dec 11, 12:37 pm, Nico <noem...@noemai l.comwrote:
    Hello,
    >
    I tried to upload in my website the following trial php file:
    >
    <FORM METHOD="POST" ACTION="prova.p hp">
    <b>Combinatio n</b><br><br>
    Element 1: <INPUT NAME="el1" TYPE="TEXT">
    <BR>
    Element 2: <INPUT NAME="el2" TYPE="TEXT">
    <br>
    <INPUT TYPE="SUBMIT" VALUE"Submit">
    </FORM>
    <br>
    Combination<br> <br>
    <?php
    >
    session_start() ;
    $_SESSION["combinatio ns"][] = ($_REQUEST["el1"].$_REQUEST["el2"]);
    print_r($_SESSI ON["combinatio ns"]);
    ?>
    >
    As result, I obtain the following error:
    >
    Warning: session_start() [function.sessio n-start]: Cannot send session
    cookie - headers already sent by (output started at
    /home/httpd/docs/prova.php:12) in /home/httpd/docs/prova.php on line 13
    >
    Warning: session_start() [function.sessio n-start]: Cannot send session
    cache limiter - headers already sent (output started at
    /home/httpd/docs/prova.php:12) in /home/httpd/docs/prova.php on line 13
    >
    Sessions don't work.
    Can you help me to understand which is the problem and how can I solve
    it please?
    Many thanks.
    >
    Cheers,
    Nico

    Comment

    • Nico

      #3
      Re: Sessions 2

      solved. many thanks.
      there was a blank line before "session_start( )".
      cheers,
      Nico

      In article <1165823131.185 032.81740@16g20 00cwy.googlegro ups.com>,
      "theCanceru s" <thecancerus@gm ail.comwrote:
      hello nico,
      >
      this error comes when you send anything to browser before starting
      session. this happens with any header function you may use. to solve
      this you must put "session_start( )" at the start of php the page as i
      had shown you in your the previous post.
      >
      this will solve your problem.
      >
      cheers
      Amit
      >
      On Dec 11, 12:37 pm, Nico <noem...@noemai l.comwrote:
      Hello,

      I tried to upload in my website the following trial php file:

      <FORM METHOD="POST" ACTION="prova.p hp">
      <b>Combinatio n</b><br><br>
      Element 1: <INPUT NAME="el1" TYPE="TEXT">
      <BR>
      Element 2: <INPUT NAME="el2" TYPE="TEXT">
      <br>
      <INPUT TYPE="SUBMIT" VALUE"Submit">
      </FORM>
      <br>
      Combination<br> <br>
      <?php

      session_start() ;
      $_SESSION["combinatio ns"][] = ($_REQUEST["el1"].$_REQUEST["el2"]);
      print_r($_SESSI ON["combinatio ns"]);
      ?>

      As result, I obtain the following error:

      Warning: session_start() [function.sessio n-start]: Cannot send session
      cookie - headers already sent by (output started at
      /home/httpd/docs/prova.php:12) in /home/httpd/docs/prova.php on line 13

      Warning: session_start() [function.sessio n-start]: Cannot send session
      cache limiter - headers already sent (output started at
      /home/httpd/docs/prova.php:12) in /home/httpd/docs/prova.php on line 13

      Sessions don't work.
      Can you help me to understand which is the problem and how can I solve
      it please?
      Many thanks.

      Cheers,
      Nico

      Comment

      Working...