FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot send session cookie
#1
I have just started using the API in the tutorials, because my client will need a multi-page form where users can edit info any way they like and even have a secure login.

I have created a very simple php page with a form that has one text field and a submit button with the name submit.

Upon going to the page - I get error messages:

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/r/c/l/rclark3345/html/parental_info.php:1) in /home/content/r/c/l/rclark3345/html/formtools/global/api/api.php on line 382

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/r/c/l/rclark3345/html/parental_info.php:1) in /home/content/r/c/l/rclark3345/html/formtools/global/api/api.php on line 382

Warning: Cannot modify header information - headers already sent by (output started at /home/content/r/c/l/rclark3345/html/parental_info.php:1) in /home/content/r/c/l/rclark3345/html/formtools/global/api/api.php on line 383

Warning: Cannot modify header information - headers already sent by (output started at /home/content/r/c/l/rclark3345/html/parental_info.php:1) in /home/content/r/c/l/rclark3345/html/formtools/global/api/api.php on line 384




Here is my PHP file (very small for testing):

<?php
require_once("formtools/global/api/api.php");
$fields = ft_api_init_form_page("", "test");
$params = array(
"submit_button" => "submit",
"next_page" => "thank_you.php",
"form_data" => $_POST,
"file_data" => $_FILES,
"finalize" => true
);
ft_api_process_form($params);
?>


<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">

<label>Middle Name?</label>
<input name="PMidName" type="text" size="45" id="PMidName" />

<input type="submit" name="submit" value="Submit" />
<br />
</p>
</form>



I have been at this for hours, trying everything I can, but nothing seems to change the error or make it go away. Can someone please assist?
Reply
#2
Hi Scaphis,

Sorry you're having trouble!

Is there anything else in your PHP file? The reason I ask is that I don't see the opening and closing <html> tags, nor <body> or <head>.

The two most likely causes of this problem are:
1. that the block of PHP you're included appears BENEATH the opening <html> tags. It should always appear at the very top of the page, before anything else.
2. There's some additional PHP code that appears at the top of the page.

Any help?

- Ben
Reply
#3
(Apr 9th, 2009, 6:43 PM)Ben Wrote: Hi Scaphis,

Sorry you're having trouble!

Is there anything else in your PHP file? The reason I ask is that I don't see the opening and closing <html> tags, nor <body> or <head>.

The two most likely causes of this problem are:
1. that the block of PHP you're included appears BENEATH the opening <html> tags. It should always appear at the very top of the page, before anything else.
2. There's some additional PHP code that appears at the top of the page.

Any help?

- Ben
Ben, Thank you for your timely response.

I had it the way you specified but it made no difference. I was getting that error message every time I uploaded a php file with the api. I think it had something to do with the server I was on (godaddy) and the way it stores sessions. Anyways I tried a different server and it works now.

Now if I could only figure out how to use submission accounts module.
Reply
#4
Heya,

I'm not terribly surprised. Godaddy are great for domain registration, but their hosting is TERRIBLE! I've heard nothing but complaints from people about it.

Let me know if you have any questions about the Submission Accounts module.

- Ben
Reply
#5
(Apr 10th, 2009, 12:25 PM)Ben Wrote: Heya,

I'm not terribly surprised. Godaddy are great for domain registration, but their hosting is TERRIBLE! I've heard nothing but complaints from people about it.

Let me know if you have any questions about the Submission Accounts module.

- Ben

You are so right - funny thing is every client I have requests me to build a site on their go daddy hosting, and every time I have some kind of issue.

here is an article I found about security problems with godaddy sessions. I think it is the very reason why formtools api does not work on their hosting. Because their mysql database is on a seperate server, it stores sessions in tmp directory. Permissions need to be allowed for users and thus making it vulnerable. Correct me if I am wrong.

http://stackoverflow.com/questions/48788...odaddy-php
Reply
#6
Ah... interesting.

In that case, I'd use database sessions instead. Form Tools comes with the option of storing all session data in the database rather than in files using the default PHP sessions. To do this, just log out then add this line to your config.php file:

PHP Code:
$g_session_type "database"

Once you log back in, all sessions are stored in a separate table in the database. This *should* solve the problem... knock on wood.

Just thought I'd mention it in case other folk encounter a similar problem!

- Ben
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)