phpmady Posted May 1, 2010 Share Posted May 1, 2010 Hi, This is the error am getting... Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\xampp\htdocs\ct_sucess1\admin\findmenu.php:1) in D:\xampp\htdocs\ct_sucess1\admin\global.php on line 3 I have a page where am using template.. menu_add.php calling the template menu_add.html where in the menu_add.html page, am trying to call the findmenu.php, where this page is called whenever the select box changes for language...(ajax call) Here is the code for menu_add.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="rtl"> <HEAD> <TITLE>menu</TITLE> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1256"> <meta http-equiv="Content-Language" content="ar-sa"> <META name="author" content="Technology Skills"> <META name="copyright" content="Technology Skills-2009 "> <META name="keywords" content="cms touch, content management system, technology skills, saudi arabia, riyadh"> <META name="description" content="CMS Touch is a Content Management System developed by Technology Skills, Saudi Arabia, Riyadh"> <META name="date" content="21-11-2009"> <LINK href="css1/general1.css" type=text/css rel=stylesheet> <link href="css1/test/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/ajax_menulistchange.js" language="javascript"></script> <script type='text/javascript'> function menuonchange() { if(document.menu_add.Menu_Type.value == "none") { var e = document.getElementById("dis"); e.style.display = 'block'; } else { var e = document.getElementById("dis"); e.style.display = 'none'; } } </script> <script type="text/javascript" src="ckeditor/ckeditor.js"></script> <script src="v/scriptaculous/lib/prototype.js" type="text/javascript"></script> <script src="v/scriptaculous/src/effects.js" type="text/javascript"></script> <script type="text/javascript" src="v/fabtabulous.js"></script> <script type="text/javascript" src="v/validation.js"></script> <link rel="stylesheet" type="text/css" href="v/style.css" /> </HEAD> <BODY> <!-- START BLOCK : add --> <form name="menu_add" method="post" action="menu.php?do=add" enctype="multipart/form-data"> <div id="container"> <!-- Frame Head Starts--> <div id="frame_head">القوائم </div> <!-- Frame Head Ends--> <div class="line"> </div> <!-- Sub- Frame Head Starts--> <div id="frame_head"> إضافة قائمة جديدة</div> <!-- Sub Frame Head Ends--> <!-- First Title Starts--> <div class="login_form" dir="rtl"> <div class="row"> <span class="label"> أختار اللغة<span class="men">*</span></span> <!-- <span class="formw"><select size="1" name="Language_ID" onchange="getMenu(this.value)">--> <span class="formw"><select size="1" name="Language_ID" onchange="getMenu(this.value)" class="required"> <option value="">Select Language</option> <!-- START BLOCK : Language --> <option value="{Language_ID}" {selected}>{Language_Name}</option> <!-- END BLOCK : Language --> </select></span> </div> <div class="row"> <span class="label">Menu Type<span class="men">*</span></span> <span class="formw" id="vvdiv"><select size="1" name="Menu_Type"> <option value="">Select Language First</option> </select></span> </div> <div class="row"> <span class="label">أسم القائمة<span class="men">*</span></span> <span class="formw"><input type="text" class="required textbox_forms" name="Menu_Name" id="Menu_Name"></span> </div> <!-- START NONE DIV :: HTML EDITOR FOR CONTENT --> <div class="row" style="display:none;" id="dis"> <div class="editor_label">Menu Content</div> <div> </div> <div class="editor_row"> <textarea class="textarea_forms" dir="rtl" rows="1" id="Menu_Content" name="Menu_Content" cols="50"></textarea> <script type="text/javascript"> CKEDITOR.replace( 'Menu_Content' ); </script></span> </div> </div> code for findmenu.php <?php include("global.php"); $lid=$_GET["lid"]; $query="select * from menu_list where Language_ID = $lid and Menu_Type not in (select Menu_Type from menu where Language_ID = $lid)"; $result=$DB_site->query($query); ?> <select name="Menu_Type" onchange='javascript:menuonchange();' class="required"> <option value="">Select Menu Type</option> <option value="none">None</option> <? while($row=mysql_fetch_array($result)) { ?> <option value=<?=$row['Menu_Type']?>><?=$row['Menu_Type']?></option> <? } ?> </select> in the global.php file, i have session_start(); calling in the second line.. So can u pls help me out to sort this problem.. Thanks in Advance Quote Link to comment https://forums.phpfreaks.com/topic/200380-need-help/ Share on other sites More sharing options...
awjudd Posted May 1, 2010 Share Posted May 1, 2010 That error message comes up when you start emitting HTML before calling 'session_start ()'. If you at the findmenu.php code that you posted, there is an extra space at the very beginning which may be causing your issue. If not, can you see if HTML is being emitted anywhere before that ... for example in global.php or anything? ~juddster Quote Link to comment https://forums.phpfreaks.com/topic/200380-need-help/#findComment-1051580 Share on other sites More sharing options...
phpmady Posted May 1, 2010 Author Share Posted May 1, 2010 Thank You Juddser, U are right, space in the findmenu.php cause my problem.. I have previously encountered this kind of problem, but unable to recollect.. One more question, dont php have any technique to overcome this, bcas lefting a space causing a problem, dont it feel funny for you? Thanks Known is a Drop unknown is a Ocean That error message comes up when you start emitting HTML before calling 'session_start ()'. If you at the findmenu.php code that you posted, there is an extra space at the very beginning which may be causing your issue. If not, can you see if HTML is being emitted anywhere before that ... for example in global.php or anything? ~juddster Quote Link to comment https://forums.phpfreaks.com/topic/200380-need-help/#findComment-1051585 Share on other sites More sharing options...
Alex Posted May 1, 2010 Share Posted May 1, 2010 You could use output buffering, but problems like this are typical and in most cases it's not necessary to use output buffering. Quote Link to comment https://forums.phpfreaks.com/topic/200380-need-help/#findComment-1051590 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.