You need to add something like page.php
[php]$_SESSION[‘fid’] = $id;[/php]
Then in your newthread.php add something like
[php]
$id = $_SESSION[‘fid’];
[/php]
You need to add something like page.php
[php]$_SESSION[‘fid’] = $id;[/php]
Then in your newthread.php add something like
[php]
$id = $_SESSION[‘fid’];
[/php]
now it shows Array ( [username] => admin [id] => 1 [fid] => )
needs to be under the GET[id] if you placed it at the very top
but I am sure you are coming from another page to this one like index.php or there is an include of another file
[php]$_SESSION[‘fid’] = $id;[/php]
yes i have it under the GET[‘id’] , yes i am coming from page.php and no there is no included files
Have you echoed out the $id in that file does it give you any value ?
try adding to the top of page.php
[php]session_start();[/php]
already have it
Did you check in page.php if the $id was geting assigned to the $_session[‘fid’] ?
I cant see where the forumid is coming from so add the 2 pages together and see how that works out and call it the category.php new thread id is being made with $threadid = mysql_insert_id(); but nothing about the forumid
so what shall i do now ?
Does it work correctly like that ?
when the 2 pages are in one ?
I do not think it will because page.php has something sent to it ot posted to it that is not being sent to the pages you made the reason one works and the other does not is because one makes a new thread id the other need to be given the id of the forum.
Put this at the bottom of the page.php then go to that page in your admin give me the results.
[php]
<?php $trace=debug_backtrace(); foreach($trace as $t) { if (in_array($t['function'], array('include', 'include_once', 'require', 'require_once'))) { echo '[/php]
added that code but nothing showed … and yes it works great when these 2 files are in one
What happens if you use this code ?
This is not set because you are not postings i didnot notice this before.
[php]if (isset($_POST[‘new_thread’])){[/php]
[php]
<?php $id = mysql_real_escape_string(mysql_real_escape_string($_GET['id'])); $sidor_totalt = 1; if (!isset($_POST['new_thread'])){ $subject = mysql_real_escape_string($_POST['subject']); $text = mysql_real_escape_string($_POST['text']); if (trim(empty($subject)) or trim(empty($text))){ echo ""; }else{ mysql_query("INSERT INTO `forum_thread` (`categoryid`, `subject`, `posted`, `last_answer`)VALUES('$id', '$subject', '$current_date', '$current_date')") or die(mysql_error()); $threadid = mysql_insert_id(); $userid = $_SESSION['id']; mysql_query("INSERT INTO `forum_answer` (`userid`, `threadid`, `text`, `date`)VALUES('$userid', '$threadid', '$text', '$current_date')") or die(mysql_error()); echo ""; } } ?>[/php]
when posting , it redirect me to the start page while showing following url “http://site.com/page.php?name=forumcategory&id=” and also as soon i got to newtopic.php it gives me an error alert “Alla fält är inte ifyllda.”
which is comming from this code [php]if (trim(empty($subject)) or trim(empty($text))){
echo "";[/php]
Sorry I do not think I can help you as you will not show any more code that the forumid is coming from I canoot guess the var assigned to the forumid by the looks of the code.
The only thing that $_GET[$ID] is for is the admin id and not the forumid.
There has to be some more code added some where or a function that gets the forumid