MLM Installation Problem

kbmusic

New Member
I spent several hours yesterday trying to get MLM to work on my website. I know it's something simple that I'm missing but the instructions are not step-by-step, so I'm spending a lot of time guessing on the solutions.

Here's my situation in a nutshell; I completed all of the "simple" steps listed:

1.- Open the mlm_settings.php file with a text editor (TextWrangler).
2.- Edit the script settings and save.
3.- Upload the MLM folder to your FTP server (using Cyberduck).
4.- Use your FTP software to CHMOD the MLM folder to 777 (or 775).
5.- I'm currently not using mySQL until I can get the MLM application to work. I'm trying to keep it simple for now.

After uploading the MLM folder to my FTP server (Siteground) and republishing my website, everything looks fine until I click on the newsletter "submit" button... nothing happens. It appears that there is no connection between the submit button and the php scripts that are listed in the html folder. How do I make that happen? I've checked the Maxrprog forums, user guides, YouTube, and I Googled for solutions as well. So far I haven't been able to find answer to my issue. What other steps am I missing? Please let me know if you need more specific information in order to resolve my MLM issue. I really would like to upgrade to MaxBulk Mailer but I'm not compelled to do so until I can resolve this particular issue. Thanks for your reply.
 

stanbusk

Administrator
Staff member
Indeed there is no other steps. What is the URL of your script? and the URL of the page with the submit button?
 

kbmusic

New Member
"Indeed there is no other steps. What is the URL of your script? and the URL of the page with the submit button?"

Thanks for you quick reply stanbusk. When you ask "What is the URL of your script?" Do you mean the path on the server? If so, that would be: public_html/mlm/html/subscribe_single_fixed.php. If not, then this is probably were the problem is. What do I need to do to connect the click of the submit button to the subscribe script? The URL of the page with the submit button is: http://www.bapentertainment.com/videography/blog.html.
 

kbmusic

New Member
Below is the script that I'm using to create the subscription form on the website. It's placed within the sidebar of my website editor (RapidWeaver). Do I need to edit the php URL, script or command somewhere within this html? If so, exactly where and what do I edit within the form script?

<div id="wrapper">

<form method="get" id="myForm" action="http://www.bapentertainment.com/mlm/mlm.php">
<input type="hidden" name="cmd" value="subscribe" />
<input type="hidden" name="list" value="News" />
<input type="hidden" name="resptype" value="simple" />
<table cellpadding="0" cellspacing="4">
<h3>Sign Up to Our Newsletter</strong></h3>
<p><em>To be informed about special deals and for general news</em></p>
<tr>
<td>First Name:</td>
<td><span><input type="text" name="firstname" value="" /></span></td></tr>
<tr>
<td>Last Name:</td>
<td><span><input type="text" name="lastname" value="" /></span></td>
<td></td>
</tr>
<tr>
<td>Email:</td>
<td><span><input type="text" name="email" value="" /></span></td>
<td></td>
</tr>
<tr>
<td></td>
<td><input type="submit" id="submit" value="submit" /></td>
</tr>
</table>
</form>
<div id="response">
</div></div>
 

stanbusk

Administrator
Staff member
I have tried http://www.bapentertainment.com/mlm/html/subscribe_single_fixed.php and it looks like everything is working properly.

However your form is wrong. Look at the HTML templates. They are PHP files and we run code at the beginning. Your form is in an HTML file. It doesn't work that way. You should change the page extension to PHP and add the PHP code to your file as we have done in the templates.

By the way I like how your page looks like!
 

kbmusic

New Member
"However your form is wrong. Look at the HTML templates. They are PHP files and we run code at the beginning. Your form is in an HTML file. It doesn't work that way. You should change the page extension to PHP and add the PHP code to your file as we have done in the templates."

Thank you for the compliment on the design of my website stanbusk. I use RapidWeaver as my web design software. It does most of the heavy lifting (i.e. coding) for me. I did change my blog page from the "html" extension to "php" as you had suggested, but I'm not clear on the remainder of your instructions. I'm a novice at coding so I need step-by-step hand holding... Which leads me to ask:

1. What PHP code are you referring to that I need to add?
2. Which file do I need to add the code to?
3. Where do I add the code within the file?

Thanks again. I appreciate your help.
 

stanbusk

Administrator
Staff member
1. What PHP code are you referring to that I need to add?
It is the code between the '<?php' and '?>' tags at the beginning. There is even more code delimited with the same tags embedded in the HTML code for error checking and for placing data again in the field in case of error.
2. Which file do I need to add the code to?
The file you just renamed from '.html' to '.php'. The one that contains the subscription from.
3. Where do I add the code within the file?
Look for the opening '<?php' and closing '?>' tags. You should add the code in the same places.
 

kbmusic

New Member
First of all, I apologize for the long post but I'm still having problems and I desperately need your expertise... Per your instructions, I added the following code to my blog file:

<?php

<div id="wrapper">

<form method="get" id="myForm" action="http://www.bapentertainment.com/mlm/mlm.php">
<input type="hidden" name="cmd" value="subscribe" />
<input type="hidden" name="list" value="News" />
<input type="hidden" name="resptype" value="simple" />
<table cellpadding="0" cellspacing="4">
<h3>Sign Up to Our Newsletter</strong></h3>
<p><em>To be informed about special deals and for general news</em></p>
<tr>
<td>First Name:</td>
<td><span><input type="text" name="firstname" value="" /></span></td></tr>
<tr>
<td>Last Name:</td>
<td><span><input type="text" name="lastname" value="" /></span></td>
<td></td>
</tr>
<tr>
<td>Email:</td>
<td><span><input type="text" name="email" value="" /></span></td>
<td></td>
</tr>
<tr>
<td></td>
<td><input type="submit" id="submit" value="submit" /></td>
</tr>
</table>
</form>
<div id="response">
</div></div>

if ( isset( $_REQUEST['cmd'] ) && !empty( $_REQUEST['cmd'] ) ) { $cmd = $_REQUEST['cmd']; }
if ( isset( $_REQUEST['email'] ) && !empty( $_REQUEST['email'] ) ) { $email = $_REQUEST['email']; }
if ( isset( $_REQUEST['list'] ) && !empty( $_REQUEST['list'] ) ) { $list = $_REQUEST['list']; }
if ( isset( $_REQUEST['firstname'] ) && !empty( $_REQUEST['firstname'] ) ) { $firstname = $_REQUEST['firstname']; }
if ( isset( $_REQUEST['lastname'] ) && !empty( $_REQUEST['lastname'] ) ) { $lastname = $_REQUEST['lastname']; }

if ( isset( $_REQUEST['submit'] ) ) {
$errors = array();
if ( $email == "" ) { $errors[] = "Enter your email address in the email address text box"; $wrong['email'] = TRUE; }
if ( $email !== "" && ( stristr( $email, "." ) == FALSE || stristr( $email, "@" ) == FALSE ) ) { $errors[] = "The e-mail address you have entered is not valid"; $wrong['email'] = TRUE; }
if ( $firstname == "" ) { $errors[] = "Enter your fist name in the fist name text box"; $wrong['firstname'] = TRUE; }
if ( $lastname == "" ) { $errors[] = "Enter your last name in the last name text box"; $wrong['lastname'] = TRUE; }

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

?>

The first half of the code between '<?php' and '?>' is the code to create the submit form and the second half of the code is the code from the "subscribe_single-fixed" file that you instructed me to place within my blog file.

Now when I try to open the blog in my browser I see a blank page with the following message: "Parse error: parse error, unexpected '<' in /home/bapente1/public_html/videography/blog.php on line 134."

Line 134 is the 2nd line of the above code (i.e. <div id="wrapper">).

I've obviously added the code in the wrong place. I also placed the code (from the "subscribe_single-fixed" file) at the beginning of the blog file and outside of the div tags. And although I can see my page design with that placement, the "submit" button still does not work. Is there some specific information that you need from me to to get the form submit button to work? This has become very frustrating. I feel that perhaps I'm not communicating the right information to allow you to help me to resolve this issue. Would it be advantageous if I send you my entire source code for my blog page? Perhaps by doing so, you will be able to show me exactly what code goes in which location. And lastly, MaxBulk Mailer looks to be an amazing application. It's exactly what I need to help administer my email/newsletter marketing program. Is fixing this MLM issue a pre-requisite to purchasing MaxBulk Mailer and getting it to successfully work with my blog?
 

stanbusk

Administrator
Staff member
You have pasted the PHP code in the wrong place. Between '<?php' and '?>' you can only have PHP code. In the code you have posted you have included HTML code in side the PHP tags. Wrong. You have to paste the code at the very beginning of your file. The code to paste is
Code:
<?php 
if ( isset( $_REQUEST['cmd'] ) && !empty( $_REQUEST['cmd'] ) ) { $cmd = $_REQUEST['cmd']; } 
if ( isset( $_REQUEST['email'] ) && !empty( $_REQUEST['email'] ) ) { $email = $_REQUEST['email']; } 
if ( isset( $_REQUEST['list'] ) && !empty( $_REQUEST['list'] ) ) { $list = $_REQUEST['list']; } 
if ( isset( $_REQUEST['firstname'] ) && !empty( $_REQUEST['firstname'] ) ) { $firstname = $_REQUEST['firstname']; } 
if ( isset( $_REQUEST['lastname'] ) && !empty( $_REQUEST['lastname'] ) ) { $lastname = $_REQUEST['lastname']; } 

if ( isset( $_REQUEST['submit'] ) ) { 
$errors = array(); 
if ( $email == "" ) { $errors[] = "Enter your email address in the email address text box"; $wrong['email'] = TRUE; } 
if ( $email !== "" && ( stristr( $email, "." ) == FALSE || stristr( $email, "@" ) == FALSE ) ) { $errors[] = "The e-mail address you have entered is not valid"; $wrong['email'] = TRUE; } 
if ( $firstname == "" ) { $errors[] = "Enter your fist name in the fist name text box"; $wrong['firstname'] = TRUE; } 
if ( $lastname == "" ) { $errors[] = "Enter your last name in the last name text box"; $wrong['lastname'] = TRUE; } 

if ( count( $errors ) == 0 ) { 
$url = "../mlm.php"; 
$url .= "?cmd=$cmd&list=$list&email=$email&firstname=$firstname&lastname=$lastname"; 
header("Location: $url"); 
} 
} 
?>
Then in your form, the action should use your page URL, not the MLM url. This is very important else it will not work.
 

kbmusic

New Member
Thanks for your response stanbush.

OK, here's what I've done:

1. I copied the exact code from your message to the very beginning of the blog file (before the <!DOCTYPE> tag).
2. I changed the URL in the blog form code (line 154) to: http://www.bapentertainment.com/videography/blog.php.
3. I verified that the javascript code for the submit button was located between the <script> tags.
4. I verified that the html code for the submit form was in the sidebar.
5. I verified the mlm_settings.php as follows:

$admin_id = "xxxx";
$admin_password = "xxxx";
$admin_notifications = 1;

$admin_err_addr = "[email protected]";
$admin_address = "[email protected]";
$admin_name_full = "BAP Entertainment";
$admin_name_short = "BAP";
$admin_webAddress = "http://www.bapentertainment.com/videography/blog.php" . $_SERVER['HTTP_HOST'];


I then republished the file to the server and opened my text editor to verify that the of source code looks accurate. Everything looked good and I began to have confidence that it's finally going to work. Then when I refreshed the blog page in the browser and viewed the source code from within the browser, I did not see the prefixed code at the beginning of my file as I did when I viewed it in my text editor. But I did see the corrected URL in the form area of the code. So, I went back to the text editor again to view the full code and everything looked fine. But, of course, after clicking on the submit button on the blog page it yielded no results.

Why am I able to see the prefix code when I view it in my text editor but not in the browser's "view source" window? I have a feeling that I'm missing something very simple. I just haven't been able to put my finger on it yet. Do you have any other suggestions? Thanks again stanbush. I really appreciate your patience and your help.
 

stanbusk

Administrator
Staff member
PHP is a preprocessor programming language. When you insert PHP code into a page and then load that page in your browser the web server executes the code. As a result when you look at the source of a PHP file in your browser you will never see any PHP code. It has been executed already. Javascript works differently since the code resides on the page and can be executed at any time.

To fix your problem try to remove the following from your page:
Code:
		<script type="text/javascript">
			 window.addEvent('domready', function(){
	$('myForm').addEvent('submit', function(e) {
	    new Event(e).stop();
	    var resp = $('response').empty();
	   this.send({
	        update: resp,
	        onComplete: function() {
	            
	        }
	    });
	});
}); 
		</script>
 

kbmusic

New Member
Thanks for the suggestion stanbusk. I removed the javascript code as you had suggested, republished my blog and now when I click on the submit button the text disappears from the form and the web address in the address bar changes to:

http://www.bapentertainment.com/videogr ... 0yahoo.com

Clicking on the submit button still doesn't direct me to a confirmation URL or send me an email, but I can at least see that we are closer to a solution. I'm thinking that there may be a problem with the html code for the subscription form. Please take a look at the code for my subscription form below. Do I have any errors that need to be corrected?

<div id="wrapper">

<form method="get" id="myForm" action="http://www.bapentertainment.com/videography/blog.php">
<input type="hidden" name="cmd" value="subscribe" />
<input type="hidden" name="list" value="News" />
<input type="hidden" name="resptype" value="simple" />
<table cellpadding="0" cellspacing="4">
<h3>Sign Up to Our Newsletter</strong></h3>
<p><em>To be informed about special deals and for general news</em></p>
<tr>
<td>First Name:</td>
<td><span><input type="text" name="firstname" value="" /></span></td></tr>
<tr>
<td>Last Name:</td>
<td><span><input type="text" name="lastname" value="" /></span></td>
<td></td>
</tr>
<tr>
<td>Email:</td>
<td><span><input type="text" name="email" value="" /></span></td>
<td></td>
</tr>
<tr>
<td></td>
<td><input type="submit" id="submit" value="submit" /></td>
</tr>
</table>
</form>
<div id="response">
</div></div>
 

stanbusk

Administrator
Staff member
It look like you have removed the 'HEADER' command from the PHP code, did you? Now it is not calling MLM at all.
 
Top