[how to] put a subscribe form on one of my website pages

Solutions for other phpList version 2 users
Forum rules
Please do not ask questions here, this is for Solutions you have discovered or come across.

Postby markcrobinson » 4:23pm, Wed 30 Jul, 2008

Thanks!
Probably the best way to troubleshoot this would be if there was a snippet of code I could place in the receiving page that would tell me what variables were being passed through.

Got anything like that?

Thank you
markcrobinson
phpLister
 
Posts: 14
Joined: 2:04am, Fri 19 Jan, 2007

Postby Guest » 9:52am, Wed 03 Sep, 2008

Ive been messing around with this thing for about 4 days and can't figure out why its not working. Ive went through the initial post and my code 1,000 times. Everytime I enter the information through my website, it takes me to the php page.

Im on the verge of using bravenet and ending my frustrations. Here is my code:

Code: Select all
function checkform() {
  for (i=0;i<fieldstocheck.length;i++) {
    if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].type") == "checkbox") {
      if (document.subscribeform.elements[fieldstocheck[i]].checked) {
      } else {
        alert("Please enter your "+fieldnames[i]);
        eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
        return false;
      }
       return true;
}

function addFieldToCheck(value,name) {
  fieldstocheck[fieldstocheck.length] = value;
  fieldnames[fieldnames.length] = name;
        </script>
      </div>
      <form action="http://getfitjersey.com/phplist/?p=subscribe" name="subscribeform">
    Email:<input type="text" name="attribute2" value = "">
  <script language="Javascript" type="text/javascript">addFieldToCheck("attribute2","Email Address");</script><br>
  Name: <input type="text" name="attribute1" value = "">
  <script language="Javascript" type="text/javascript">addFieldToCheck("attribute1","Name");</script>
  Birthdate: <input type="text" name="attribute3" value = "">
  <script language="Javascript" type="text/javascript">addFieldToCheck("attribute3","Birthdate");</script>
  <input type="hidden" name="list[1]" value="signup"  /> <br>
  <input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();" >
      </form></td>

I cant view this threads pages 4-13 either so that doesnt help. Please can someone give me something???
Guest
 

Postby H2B2 » 1:14pm, Wed 03 Sep, 2008

neart4 wrote:Everytime I enter the information through my website, it takes me to the php page.
That is because phplist does not get the info it expects to get. and thus it goes to the default subscribe page.

This is the summarized content of the form you tested:
Code: Select all
<form action="http://getfitjersey.com/phplist/?p=subscribe" name="subscribeform">
<input type="text" name="attribute2" value = "">
<input type="text" name="attribute1" value = "">
<input type="text" name="attribute3" value = "">
<input type="hidden" name="list[1]" value="signup" /> <br>
<input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();" >
</form>


This is the summarized version of your non-customized default phplist form:
Code: Select all
<form method=post name="subscribeform">
<input type=text name=email value="" size="40">
<input type=hidden name="htmlemail" value="0">
<input type=text name="attribute1" size="40" value="">
<input type=text name="attribute3" size="40" value="">
<input type="hidden" name="list[1]" value="signup">
<input type="hidden" name="listname[1]" value="List"/>
<input type=submit name="subscribe" value="Subscribe" onClick="return checkform();">
</form>


A quick check of your custom code shows that you omitted the "email" attribute name and used "attribute2" instead. The email field is a special attribute in phplist and should always be called "email". You also omitted the form method "post".
So I think the customized form -again summarized- should look like this:
Code: Select all
<form method="post" action="http://getfitjersey.com/phplist/?p=subscribe" name="subscribeform">
<input type="text" name="email" value="" size="40">
<input type="hidden" name="htmlemail" value="0">
<input type="text" name="attribute1" size="40" value="">
<input type="text" name="attribute3" size="40" value="">
<input type="hidden" name="list[1]" value="signup">
<input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();">
</form>


Read the relevant doc very carefully. It contains all the info you need: http://docs.phplist.com/CustomSubscribeForm
Also, make sure that the list ID number in <input type="hidden" name="list[1]" value="signup"> really refers to the list you want to offer.
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Postby Guest » 8:08pm, Wed 03 Sep, 2008

<form method="post"


This is the part I was missing. THANK YOU. Dude seriously can I send you a present?

I figured out the double email thing after I posted this question, but still couldnt get it to work. Now I want to work with the confirmation page.

form method="post" action="http://www.mysite.com/lists/?p=subscribe" name="signup" target="windowName" onsubmit="window.open('', this.target,
'dialog,modal,scrollbars=no,resizable=no,width=550,height=300,left=0,top=0');">


Besides the mysite part, what do I edit here? Do I eliminate the "this.target,"?
Guest
 

Postby Gespenster » 10:03am, Wed 25 Mar, 2009

After reading and searching a lot I still didn't get the custom subscribe form to work. I did some analysis on the HTTP POST request sent to the server to see what is different. The only thing that was different was the HTTP REFERRER field. Now I assume there is some security measure that accidentally doesn't allow a custom subscribe form to reside on a different host. Can anybody confirm this and how would I be able to circumvent this problem (putting both the form and phplist on the same host is not an option).

EDIT: The form does work but when a user clicks subscribe, the user gets the phplist subscribe page with his data prefilled and has to submit one more time before he gets the page that says that a confirmation mail is sent.

EDIT2: Just some pointers to the locations in the PHP code where this could be fixed would also be great help.
Gespenster
phpList newbie
 
Posts: 1
Joined: 9:59am, Wed 25 Mar, 2009

Postby jjbgoode » 7:46pm, Thu 26 Mar, 2009

I'm hoping to save others from my STUPID mistake. I was having the problem where people would submit the form in my web page and they would get the default subscibe page in the pop up with empty fields. The form had been working before, but suddenly it started doing this. I had combed this thread over and over and tried every trick (and I mean EVERY trick) in here.

I was at it for hours before I realized that the reason why my form wasn't submitting was because the domain in the form action was missing the "www".
It read:

"h t t p ://domain dot com"

Instead of :

"h t t p ://www dot domain dot com"

That's all it was...

I now wear my dunce cap proudly. :wink:
jjbgoode
phpLister
 
Posts: 8
Joined: 4:13pm, Thu 18 Nov, 2004
Location: CA

Custom Subscribe Page

Postby jdwright » 3:44pm, Mon 11 May, 2009

I'm working to implement phpList on an ISP level for use by hosting clients. I am working with a politician to implement a mailing list into his website. I've created the form (code below) and it works. My problem lies with the welcome message that says "Thank you for subscribing to our newsletters." http://docs.phplist.com/CustomSubscribeForm says if you want to use a pop-up and not the standard thank-you message, to use the code supplied. Well, I've implemented that code into the form and I get the pop-up PLUS the standard thank-you message. How do I turn-off that standard message?

Code: Select all
<form method="post" action="http://lists/?p=subscribe" name="subscribeform" onsubmit="window.open('thanks.html', this.target,
'dialog,modal,scrollbars=no,resizable=no,width=550,height=300,left=0,top=0');">
<input type="hidden" name="list[3]" value="signup">
<input type="hidden" name="subscribe" value="yes">
  <table width="90%" border="0">
    <tr>
      <td width="44%" class="style2">Your Email Address </td>
      <td width="56%"><label>
        <input name="email" type="text" id="email" size="30">
      </label></td>
    </tr>
    <tr>
      <td class="style2">Please Confirm Your Email Address... </td>
      <td><input name="emailconfirm" type="text" id="emailconfirm" size="30"></td>
    </tr>
  </table>
  <p>
    <label>
    <input type="submit" name="Submit" value="Submit">
    </label>
    <input name="Reset" type="reset" id="Reset" value="Reset">
  </p>
</form>
jdwright
phpList newbie
 
Posts: 1
Joined: 3:31pm, Mon 11 May, 2009

How to redirect subscribers...

Postby celinehoran » 10:09pm, Sun 17 May, 2009

Hi there...

I've been trying for the past week or so, (having
read ever instruction given in this forum - but
with no luck) to get my little subscribe box to
redirect to my own personal message after someone
signs up. I don't want them to have to sign up again,
via phplist's subscribe page when they've
already signed up from my website's sign in box.

Here is the sign in box code:

Code: Select all
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title>Celine Horan's Sign in box</title>
</head>
<body>
<br>
<br>
<!-- 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]);
eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
return false;
}
}
return true;
}
function addFieldToCheck(value,name) {
fieldstocheck[fieldstocheck.length] = value;
fieldnames[fieldnames.length] = name;
}
</script>
<form method="post"
action="http://www.celinehoran.com/Lists/?p=subscribe&amp;id=1"
name="Newsletter.html" target="_blank">Email: &nbsp; <input
name="attribute1" value="" type="text"><br>
<script language="Javascript" type="text/javascript">addFieldToCheck("email","Email Address");</script><br>
Name:&nbsp; <input name="attribute2" value="" type="text"><br>
<br>
Title: &nbsp;&nbsp;&nbsp; <input name="attribute3" value="" type="text"><br>
<script language="Javascript" type="text/javascript">addFieldToCheck("attribute2","Name");</script>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;
&nbsp;&nbsp; &nbsp;&nbsp; <input name="list[1]" value="signup"
type="hidden"> <input name="subscribe" value="Sign Up Now!"
onclick="return checkform();" type="submit"> <input name="list[1]"
value="signup" type="hidden"> </form>
<!-- newsletter subscribe ends here -->
</body>
</html>


And here is the message page I want them to be sent
to when they click the "submit" button.

http://www.celinehoran.com/subscribe.html

Please help me, I'm at my wits end. :(
celinehoran
phpList newbie
 
Posts: 1
Joined: 8:09am, Fri 15 May, 2009

Re: Custom Subscribe Page

Postby H2B2 » 10:57am, Wed 20 May, 2009

jdwright wrote:
Code: Select all
<form method="post" action="http://lists/?p=subscribe" name="subscribeform" onsubmit="window.open('thanks.html', this.target,
'dialog,modal,scrollbars=no,resizable=no,width=550,height=300,left=0,top=0');">
Wouldn't you be missing something like target="windowName" in the javascript pop-up? You might take another look at the pop-up code mentioned in the doc.


celinehoran wrote:I don't want them to have to sign up again, via phplist's subscribe page when they've already signed up from my website's sign in box.
I think phpList directs you to the default subscribe page because your custom subscribe form doesn't pass all info phpList expects to get. I might be best to start from scratch and follow the steps exactly as described in http://docs.phplist.com/CustomSubscribeForm
H2B2
Moderator
 
Posts: 7188
Joined: 1:51am, Wed 15 Mar, 2006

Re: [how to] put a subscribe form on one of my website pages

Postby royald » 3:47am, Sat 30 May, 2009

I am testing the installation locally (localhost) and I followed the instruction as stated here but when I click on my own button it takes me the url http://localhost/localhost/newsletter?p=subscribe instead of http://localhost/newsletter?p=subscribe

Any idea what I am doing wrong that makes it show localhost twice pls?
Many thanks
royald
phpList newbie
 
Posts: 1
Joined: 3:06am, Sat 30 May, 2009

Re: [how to] put a subscribe form on one of my website pages

Postby owencareyjones » 10:50am, Mon 22 Jun, 2009

I have used the code suggested and everything works except that when I subscribe, I am taken to another subscribe page. If I then hit subscribe on that page, it just comes up again! I have read through all the tips and suggestions on this thread but still can't solve the problem. What am I doing wrong - can you help me?

The code I have used is shown below:

Code: Select all
<!-- 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]);
eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
return false;
}
}
return true;
}
function addFieldToCheck(value,name) {
fieldstocheck[fieldstocheck.length] = value;
fieldnames[fieldnames.length] = name;
}
</script>
    </font> </p>
  <form method="post" action="http://www.mywebsite.com/newsletter/?p=subscribe" name="subscribeform">
    <p><font color="#F0F0F0">Email</font><font color="#F0F0F0">
      <input type="text" name="email" value = "">
      <br>
      <script language="Javascript" type="text/javascript">addFieldToCheck("email","Email Address");</script>
      </font></p>
    <p><font color="#F0F0F0">Name</font><font color="#F0F0F0">
      <input type="text" name="attribute1" value = "">
      </font></p>
    <p> <font color="#F0F0F0">
      <script language="Javascript" type="text/javascript">addFieldToCheck("attribute1","Name");</script>
      <input type="hidden" name="list[1]" value="signup" />
      <input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();">
      </font></p>
    <font color="#F0F0F0"><p></p> </font>
  </form>
  <p>&nbsp;</p><p><font color="#F0F0F0"><a href="http://careyfilms.com/newsletter/?p=unsubscribe&id=1">Unsubscribe</a></font></p>
  <font color="#F0F0F0">

<!-- newsletter subscribe ends here -->
owencareyjones
phpList newbie
 
Posts: 1
Joined: 10:37am, Mon 22 Jun, 2009

Re: How to redirect subscribers...

Postby chacco » 2:49am, Thu 20 Aug, 2009

celinehoran wrote:And here is the message page I want them to be sent
to when they click the "submit" button.

http://www.celinehoran.com/subscribe.html

Please help me, I'm at my wits end. :(

Go to "admin/subscribelib2.php" line 338 and replace

$thankyoupage = $subscribepagedata["thankyoupage"];

with

header( 'Location: http://www.celinehoran.com/subscribe.html' ) ;
chacco
phpList newbie
 
Posts: 2
Joined: 2:28am, Thu 20 Aug, 2009

Re: [how to] put a subscribe form on one of my website pages

Postby derek52 » 1:30pm, Sun 01 Nov, 2009

I cannot believe how easy that was, but where do i pick up the new subscriber email address to check receiving is ok

thank you for a brilliant script
derek52
phpLister
 
Posts: 10
Joined: 2:35pm, Thu 29 Oct, 2009

Re: [how to] put a subscribe form on one of my website pages

Postby chakar » 9:07am, Wed 30 Dec, 2009

Hi could you help my further with this topic.
I copy the code you have given in the topic, buth nothing works ?

My code
Code: Select all
<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]);
eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
return false;
}
}
return true;
}
function addFieldToCheck(value,name) {
fieldstocheck[fieldstocheck.length] = value;
fieldnames[fieldnames.length] = name;
}
</script>

<form method="post" action="http://www.webpunt-hosting.be/nieuwsbrief/?p=subscribe" name="subscribeform">

Email:
  <input type="text" name="email" value = ""><br>
<script language="Javascript" type="text/javascript">addFieldToCheck("email","Email Address");</script>
<input type="hidden" name="nieuwsbrief" value="signup" />
<input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();">
</form>

<!-- newsletter subscribe ends here -->
chakar
phpLister
 
Posts: 8
Joined: 6:11pm, Mon 21 Dec, 2009

Re: [how to] put a subscribe form on one of my website pages

Postby chakar » 4:41pm, Wed 30 Dec, 2009

Could please someone help me with the this code. I have followed everything in the topic but it doesn’t work ?

Code: Select all
<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]);
eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].focus()");
return false;
}
}
return true;
}
function addFieldToCheck(value,name) {
fieldstocheck[fieldstocheck.length] = value;
fieldnames[fieldnames.length] = name;
}
</script>

<form method="post" action="http://www.webpunt-hosting.be/nieuwsbrief/?p=subscribe" name="subscribeform">

Email:
  <input type="text" name="email" value = ""><br>
<script language="Javascript" type="text/javascript">addFieldToCheck("email","Email Address");</script>
<input type="hidden" name="nieuwsbrief" value="signup" />
<input type="submit" name="subscribe" value="Subscribe" onClick="return checkform();">
</form>

<!-- newsletter subscribe ends here -->
chakar
phpLister
 
Posts: 8
Joined: 6:11pm, Mon 21 Dec, 2009

PreviousNext

Return to Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests