I have a form (form.php) that uses the following JS code in the header:
<script type="text/javascript">
$(document).ready(function(){
$("a").click(function(){
$.post('test.php', function(data) {
$('#test').html(data);
});
});
});
</script>
A have a link in form.php that once clicked I want a drop down to appear (without refreshing the page) e.g. “Display drop down”. The code in the drop down is managed in test.php.
Test.php pulls data in from another service. In order to do get this data I use data that is kept in the session e.g. $_SESSION[‘data_that_is_sent_to_another_service’].
I start the session in form.php but in order for the test.php to get the information from the other service I need to start a session at the start of test.php.
The code works, but I then get a warning saying:
Warning: session_start() [function.session-start]:
Cannot send session cache limiter - headers already sent
(output started at /..my directory.../test.php:1) in /...my directory.../hrdeals.php on line 4
How can I get this warning not to appear (without turning off warnings in PHP)?
Any help much appreciated.
Gregor
PS – the JS might not be correct, but it’s more the SESSION issue that I can solve
session_start() must be called before outputing anything to the browser. Check test.php and make sure there is no output.