How do I add Company to the subscription html page?

runner

New Member
I am using the subscribe_single_selection page for adding to a list. I added "company" everywhere I saw firstname and lastname. I copied the html section of the form.

It displays correctly, but when I fill it out the script comes back "enter company name in company name field" and the data is returned in the wrong field.

I added company below lastname and when it returns the company text is in the lastname field and lastname text is gone.

Is there a field count for the form script that I am missing? Is there documentation for modifying the subscription form for adding the Company to it?

Thanks.
 

stanbusk

Administrator
Staff member
You have to look at the PHP code as well. The code:

if ( count( $errors ) == 0 ) {
$url = $lm_path . "?cmd=$cmd&list=$list&email=$email&firstname=$firstname&lastname=$lastname";
header("Location: $url");
}

should be:

if ( count( $errors ) == 0 ) {
$url = $lm_path . "?cmd=$cmd&list=$list&email=$email&firstname=$firstname&lastname=$lastname&company=$company";
header("Location: $url");
}
 

runner

New Member
Thank you. I knew I was missing something like that.

The Company field is Required in this default configuration. What would I change to make it optional?
 

stanbusk

Administrator
Staff member
In the 'PARAMATER CHECKING' block add:

if ( isset( $_REQUEST['company'] ) && !empty( $_REQUEST['company'] ) ) { $company = $_REQUEST['company']; }
 

runner

New Member
in looking at my file, I see that I had made all the changes you mention above, yet I still got the error.

Are there changes that need to be made to any other file than this?

Do you have a working file that has Company already defined I can use?

Thanks.
 
Top