Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   dynamically change aweber optin values without touching code (https://www.warriorforum.com/programming/909294-dynamically-change-aweber-optin-values-without-touching-code.html)

Iainhbb 2nd March 2014 11:08 AM

dynamically change aweber optin values without touching code
 
Hi There,

I was wondering if any of you code guru's out there can work this out. Or even has a solution?

I need to be able to dynamically change the values in an aweber optin form from an independant file.

For example the following html code:
<input type="hidden" name="meta_web_form_id" value="FORMIDVALUEHERE" />
<input type="hidden" name="meta_split_id" value="" />
<input type="hidden" name="listname" value="LISTNAMEHERE" />
<input type="hidden" name="redirect" value="URLREDIRECTHERE" />
<input type="hidden" name="meta_adtracking" value="LISTNAME" />
<input type="hidden" name="meta_message" value="1" />
<input type="hidden" name="meta_required" value="email" />

Has capitalised values that I need to be able update dynamicaly from a very simple text file that the HTML code refers to.

So the text file would be like this

Simpletextfile that can be edited easily.
FORMIDVALUEHERE
LISTNAMEHERE
URLREDIRECTHERE
LISTNAME


And all this can be done without even opening an HTML file.
:)

Can this be done?


Iain

Brandon Tanner 3rd March 2014 09:31 AM

Re: dynamically change aweber optin values without touching code
 
Easiest way would be to put your list values in a PHP file (just give your text file a PHP extension), and then create a variable for each value, like...

$form = "FORMIDVALUEHERE";
$listname = "LISTNAMEHERE";
$url = "URLREDIRECTHERE";


etc. etc.

Then "include" that PHP file first thing on your opt-in page, like...

<?php include('listfile.php'); ?>

Your opt-in page will need to have a PHP extension as well (ie optin.php).

Then anywhere on your optin page that you want to display a list value, you would use <?php echo $variableName; ?>. For example...

<input type="hidden" name="meta_web_form_id" value="<?php echo $form; ?>" />

Alternately, you could use Javascript / jQuery to accomplish basically the same thing, but PHP would be the most reliable way to do it, since a tiny percentage of your visitors may have JS disabled.

Let me know if you have any questions.

Iainhbb 3rd March 2014 03:15 PM

Re: dynamically change aweber optin values without touching code
 
Thanks Brandon!

I will give that a try and let you know how I get on.

Iain

Iainhbb 4th March 2014 10:17 AM

Re: dynamically change aweber optin values without touching code
 
Hi Brandon,


This is what I have in my index.php file:

Above the header I have:

<?php include('listfile.php'); ?>
<head profile="http://gmpg.org/xfn/11">....... and so on.....

At the optin area I have the following:
<input type="hidden" name="meta_web_form_id" value="<?php echo $form; ?>" />
<input type="hidden" name="meta_split_id" value="" />
<input type="hidden" name="listname" value="<?php echo $listname; ?>" />
<input type="hidden" name="redirect" value="<?php echo $url; ?>" />
and so on.....

In the listfile.php I have the following values:
$form = "342767906";
$listname = "hbblist-10000";
$url = "http://www.aweber.com/thankyou.htm?m=default";



But when I try to subscribe aweber is telling me list not active!

Have I missed somthing?

Iain

Brandon Tanner 4th March 2014 10:55 AM

Re: dynamically change aweber optin values without touching code
 
Forgot to mention that you need to put opening and closing PHP tags in your list file. For example...

<?php
$form = "342767906";
$listname = "hbblist-10000";
$url = "http://www.aweber.com/thankyou.htm?m=default";
?>

Iainhbb 4th March 2014 02:24 PM

Re: dynamically change aweber optin values without touching code
 
Excellent!

That worked a treat! Thank You very much Brandon.

Iain

Brandon Tanner 4th March 2014 03:35 PM

Re: dynamically change aweber optin values without touching code
 
Yeah, no prob! :)

PaulMcOnline 12th August 2014 06:56 AM

Re: dynamically change aweber optin values without touching code
 
Is it possible to do this in wordpress?

I've got a membership site and I want all members to be able to plug in their own aweber list name.

I've created a custom field for the each member to put in their list name and then created a function that pulls back the correct list name. I can call the function in a normal page using [GetUserRefID] and it displays the list name but when I put it in like the example below the list name ends up been blank

<input type="hidden" name="listname" value="[GetUserRefID]">

Any help appreciated


All times are GMT -6. The time now is 11:46 PM.