Hi,
I am trying to use sessions to display information from one page to the next one but I am having the following problems. Could anyone plz help me???????????
Here is my code:

``````<?php
\$pnm1=\$_POST;/////////name of text box from previous page

include("db_connect.php");

\$sql="SELECT * FROM new_party WHERE party_name='\$pnm1'";
\$result=mysql_query(\$sql);

\$count=mysql_num_rows(\$result);

if(\$count==0){

session_start();
\$_session=\$pnm1;
.................... and so on
``````

The errors that I am having is as follows:

``````Warning: session_start(): Cannot send session cookie - headers already sent by (output started at c:\program files\easyphp1-8\www\politics\pro\processregisterparty.php:2) in c:\program files\easyphp1-8\www\politics\pro\processregisterparty.php on line 19

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\program files\easyphp1-8\www\politics\pro\processregisterparty.php:2) in c:\program files\easyphp1-8\www\politics\pro\processregisterparty.php on line 19
``````

Edited by happygeek: fixed formatting

3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by buddylee17

You can't have an echo, print or any html tag before session_start and header functions. You cannot even have a whitespace.

You have to call session_start() before anything is outputted to the browser. Try calling session_start right after the opening php tags just to make sure.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.