You need to start the session before any html.  So:

<?php session_start(); ?>
<html>

Cheers!

Rick

"Too much caution is bad for you. By avoiding things you fear, you may let
yourself in for unhappy consequences. It is usually wiser to stand up to a
scary-seeming experience and walk right into it, risking the bruises as hard
knocks. You are likely to find it is not as tough as you had thought.  Or
you may find it plenty tough, but also discover you have what it takes to
handle it." - Norman Vincent Peale

> From: PHPCoder <[EMAIL PROTECTED]>
> Date: Mon, 22 Jul 2002 08:36:44 +0200
> To: php-general <[EMAIL PROTECTED]>
> Subject: [PHP] Sessions without cookies : forms
> 
> Hi, thanks for all the replies on my two previous postings relating to
> sessions and cookies.
> I have set my mind on using sessions but without cookies, so that
> entails passing the SID via relative URL's.
> My problem comes in here, when I create a simple login page with a form
> that send username and password to the next page, I start_session(); and
> then in the form action, I append the url with <?=SID?> , but that
> causes two parse errors.
> 
> Warning: Cannot send session cookie - headers already sent by (output
> started at /home/www/index.php:3) in /home/www/index.php on line 4
> 
> Warning: Cannot send session cache limiter - headers already sent
> (output started at /home/www/index.php:3) in /home/www/index.php on line 4
> 
> The code is like so:
> <html>
> <head>
> <?php
>   session_start();
> ?>
>  
> </head>
> <body>
> <form name="form1" method="post" action="admin_select_project.php?<?=SID?>">
> <table border="0" cellspacing="0" cellpadding="0">
>   <tr bgcolor="#CFCFCF">
>     <td colspan="2">Admin Login
>     </td>
>   </tr>
>   <tr>
>     <td>Username:
>     </td>
>     <td><input type="text" name="username">
>     </td>
>   </tr>
>   <tr>
>     <td>Password:
>     </td>
>     <td><input type="text" name="password">
>     </td>
>   </tr>
>   <tr>
>     <td>
>       <input type="submit" name="Submit4" value="Submit">
>     </td>
>   </tr>
> </table>
> </form>
> </body>
> </html>
> What am I missing...
> 
> Thanks
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to