HTML/PHP code for unsubscribe link?

Let's say we're in subscribe_single_fixed.php, and I would like to create a regular link (instead of the default submit button) to subscribe or unsubscribe someone from a list. This should be simple. I'm a PHP novice, but I have tried everything that looks anything like this:

Code:
<a href="http://...lm/lm.php?cmd=unsubscribe&list=[name of list]&email=<?php echo $email ?>&pwd=[password]">Unsubscribe</a>

How far off am I? Is it really a lot more difficult than something like that? Also, if you can pull the $email into the string, then you should also be able to include $admin_password as well, right? That way it's a lot more secure than just having your password out there for everyone to see. Please help.
 

stanbusk

Administrator
Staff member
PHP code is ran by the server before seeing the page to you. As a result your code is wrong since the server has no way to know the value of $email. I believe you have to omit that parameter since it is already passed by the form.
 
Ahh, I see. So shouldn't there be a way just to echo the whole string by using html in the PHP so that it is picked up by the server before the page loads? I know I've seen PHP generate html tags before in WordPress... Actually, I've seen PHP generate html in MLM! Shouldn't I be able to do that here? If so, what would the correct syntax be?
 

stanbusk

Administrator
Staff member
It is what the subscribe_single_fixed.php page does actually. Look at the beginning, there is a some PHP code. Since the form calls itself with all the data that script catches that data and sends it to to the lm.php script.
 
Top