Cannot send session cache limiter

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
system5
Forum Newbie
Posts: 14
Joined: Wed Feb 25, 2009 12:38 pm

Cannot send session cache limiter

Post 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>
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Cannot send session cache limiter

Post by Benjamin »

Read your error message carefully.
system5
Forum Newbie
Posts: 14
Joined: Wed Feb 25, 2009 12:38 pm

Re: Cannot send session cache limiter

Post 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.
Post Reply