Hello,
I'm beginner in php and I'm trying to build a forum in website.
I build form action and when user press submit it will go to "add_new_topic.php" file and then insert the data to db.
but when I do that it takes my to the index.php and logout from user.
I checked everything and also put attention that I wrote session_start() in each page to remmeber the username
but I didn't get any solution to the problem.
here the 'newtopic.php' ---> I wrote there where is exactly the problem with the form
http://pastebin.com/QRztHjyR
here the 'add_new_topic.php'
http://pastebin.com/hE5WVaH8
thank for help.
php problem with form action and build a forum
Moderator: General Moderators
Re: php problem with form action and build a forum
http://php.net/manual/en/function.session-start.php
Note:
To use cookie-based sessions, session_start() must be called before outputing anything to the browser.
Re: php problem with form action and build a forum
hey celauran,
thank you for you reply.
as you see I used session_start in all my php files and still has the problem.
thank you for you reply.
as you see I used session_start in all my php files and still has the problem.
Re: php problem with form action and build a forum
Did you read the note above?
You are clearly sending output to the browser before calling session_start().session_start() must be called before outputing anything to the browser
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: php problem with form action and build a forum
newtopic.php is sending text to the browser before session_start() is called:
////***** newtopic.php *****/////
<link href="style_forum.css" rel="stylesheet" type="text/css">
<?php
$page = 1;$sub = 1;
session_start();
////***** newtopic.php *****/////
<link href="style_forum.css" rel="stylesheet" type="text/css">
<?php
$page = 1;$sub = 1;
session_start();
(#10850)