other php script on page, session_start();

5 posts by 3 authors in: Forums > CMS Builder
Last Post: February 18, 2010   (RSS)

By rez - February 17, 2010 - edited: February 17, 2010

I have a contact form I'm using that requires this at the top of the page and works fine without CMSB code at the top:

<?php
session_start();
require_once('config.php');
?>


The config file is very simple, containing the e-mail addresses. All the other code for the contact form is in the body of the page.

The CMSB page works separately as well. Its when I try to put the form onto a working CMSB page that I have errors.

Where exactly do I put the above code? With or without its onw php tags? Everything I tried gave variable errors and others for the contact form.

Re: [rez] other php script on page, session_start();

By Djulia - February 17, 2010

Hi rez,

You can test by removing this line ?

session_start();

If not, you can test this :

<?php
require_once "./lib/viewer_functions.php";
session_write_close ();

session_name ("form");
session_start ();
require_once('config.php');
?>


It is the solution which I use with a captcha and WebsiteMembership Plugin activated.

Djulia

Re: [rez] other php script on page, session_start();

By Djulia - February 18, 2010

You tested without using the captcha?

If not, you can indicate the error message?

Djulia

Re: [Djulia] other php script on page, session_start();

By Chris - February 18, 2010

Hi rez,

What error messages are you getting? Can you post the full PHP source code of both your contact form and config.php?

On a hunch, this line looks wrong to me:

$error_array[] .= "The security code you have entered is incorrect.";

"[] =" means add new array element, while ".=" means append this string to an existing variable. I don't think it makes sense to append a string to an array element that doesn't exist yet.
All the best,
Chris