phpList - How to include a custom subscribe form

brandingIt is possible to create a small embedded custom subscribe form within your website to take someone's name and email address and auto it to your phpList subcribers list rather than using a full scubscribe page within phpList.

Copy the code below and create a new HTML page to try it out on.
1. You'll need to change the to match your domain and the directory that you installed phplist in, also the subscribe&id=1 will need to match your value for your subscribe page id.
2. Also, you'll need to match name="list[1]" to the number of your list.

3. Make sure that your phpList subscribe page that you are using, does NOT have 2nd email field as this code only asks for one. If you do ask for confirmation of email, you will end up on the phpList normal subscribe page instead of having the subscriber added to your list.

<title>New Page 2</title>


<!-- newsletter subscribe below here -->

<script language="Javascript" type="text/javascript">

var fieldstocheck = new Array();
fieldnames = new Array();
function checkform() {
for (i=0;i<fieldstocheck.length;i++) {
if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") {
alert("Please enter your "+fieldnames[i]);
return false;
return true;
function addFieldToCheck(value,name) {
fieldstocheck[fieldstocheck.length] = value;
fieldnames[fieldnames.length] = name;

<form method="post" action="" name="subscribeform">
Email:<input type="text" name="email" value = ""><br>
<script language="Javascript" type="text/javascript">addFieldToCheck("email","Email Address");</script>
Name: <input type="text" name="name" value = "">
<script language="Javascript" type="text/javascript">addFieldToCheck("name","Name");</script>
<input type="hidden" name="list[1]" value="signup" />
<input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();">

<!-- newsletter subscribe ends here --></body>



If it all works correctly, you should see a blank page with two input boxes, one for email, one for the Name and a Subscribe box . Enter your details in that and you should see a successful subscription page.

Try it out on my demo page. It is a test installation and you won't be subscribed for long as the database is re-set every 24 hours, but you should get a welcome email to make sure it works ok, so long as you give a valid email address.

Try it out.

 If you do need to use a second email field for confirmation please check out this page and view source.