Page 1 of 1

Cannot send session cache limiter

Posted: Fri Mar 13, 2009 7:57 pm
by system5
Hi guys

I'm currently using a small input form with a javascript calendar (jquery datepicker).

However I would like to have this page restricted to users who have logged into my application.

So what I've tried to do is resave the page from form.html to form.php and added the checkLogin function to check what user rank they are. However its giving me a:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/grads/public_html/computing_project/login2/extra/booking.php:1) in form.php on line 1

So I guess I should assume javascript and php won't work on the same page? Is there a way around this?

Code: Select all

<?php session_start(); checkLogin('1'); ?>
<head>
    <title>Form</title>    
        
    <!-- Main stylesheet -->    
    
    <script type="text/javascript" src="extra/javascripts/jquery.js"></script>
    <script type="text/javascript" src="extra/javascripts/jquery.form.js"></script>
    <script type="text/javascript" src="extra/javascripts/jquery.ui.js"></script>
    
    <script type="text/javascript"> 
        // wait for the DOM to be loaded 
        $(document).ready(function() {          
            // bind form using ajaxForm 
            $('#myForm').ajaxForm({ 
                // target identifies the element(s) to update with the server response 
                target: '#form_results', 
         
                // success identifies the function to invoke when the server response 
                // has been received; here we apply a fade-in effect to the new content 
                success: function() { 
                    $('#form_results').fadeIn('slow'); 
                } 
            }); 
            
            $(function(){
 
                // Datepicker
                $('#datepicker').datepicker({
                    inline: true
                });
                
                //hover states on the static widgets
                $('#dialog_link, ul#icons li').hover(
                    function() { $(this).addClass('ui-state-hover'); }, 
                    function() { $(this).removeClass('ui-state-hover'); }
                );
                
            });     
 
        });
    </script> 
    
</head>
<body>

Re: Cannot send session cache limiter

Posted: Fri Mar 13, 2009 8:25 pm
by Benjamin
Read your error message carefully.

Re: Cannot send session cache limiter

Posted: Fri Mar 13, 2009 8:56 pm
by system5
Ok well the last time I got this error it was due to a space above the php line.

However as that was not it I tried a few things......

Removed the java (still got the error)
Remove the rest of the code on the page (still got the error)
Replaced all the code with a page that works (still got the error)

At that point i just closed the page and started again and now its working.