Home >
Paid Traffic Sources >
Email
LiveValidation, Aweber, and Collecting Phone Numbers Code/Help!? (14)
09-29-2011 06:09 AM
#1
vidivo (Member)
LiveValidation, Aweber, and Collecting Phone Numbers Code/Help!?
Ok,
So if anyone can help me out, im looking to be able to do live validation on a aweber, email form, along with a cell phone field integrated inside, with 3 slots, which collects the phone number inside a .txt file instead of going through aweber.
Im trying to get this to work past day and its so confusing... Besmir's walmart example collected the email.txt but how to do this when you want to collect a cell phone number that has 3 fields?
Also how to make aweber show the livevalidation?
Any help appreciated!
09-29-2011 08:21 AM
#2
liane (Member)
subscribing - looking forward to the answer as well!
09-29-2011 08:39 AM
#3
vidivo (Member)
I'll add something to this so a coder guy can do it easily for us..
This is what you put if you want to save an email.txt file:
<?
session_start();
$email=trim(@$_SESSION['email']);
if($email!=""){
$myFile = "phones.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = $email."\n";
fwrite($fh, $stringData);
fclose($fh);
}
?>
Now how do you do it if you have 3 fields and want to save a phone number instead?
09-29-2011 11:02 AM
#4
polarbacon (Moderator)
First question would be why do you want to do this?
is there a reason why you need to save the phone number to a file...and not to aweber?
09-29-2011 12:39 PM
#5
clicktrack (Member)
This does not show aweber integration as I don't use aweber but elaborates on the code you provided to show how to collect phone number.
Code:
<?
session_start();
//Grabs Email and trims white space from front and left.
$email=trim($_REQUEST['email']);
//Grabs each section from phone number. Assuming you called the fields phone1, phone2, phone3.
$phone1 = $_REQUEST['phone1'];
$phone2 = $_REQUEST['phone2'];
$phone3 = $_REQUEST['phone3'];
//Combines the three phone numbers into one.
$phone = $phone1 . $phone2 . $phone3;
//Checks to see if email is not empty. If it is not it tries to write the email to a text file.
if($email!=""){
//Declares what file name should be
$myFile = "phones.txt";
//Tries to open the file. If it can't it dies - I would not have it die as it would stop the progress of your users.
$fh = fopen($myFile, 'a') or die("can't open file");
//Assigns what will go in file - If only email use this one.
$stringData = $email."\n";
//If you want email and phone in comma separated line then this one
$stringData = $email.",".$phone."\n";
//Writes the line in the file
fwrite($fh, $stringData);
//Closes the file
fclose($fh);
}
?>
09-29-2011 04:00 PM
#6
liane (Member)
Ok...I've been wondering something, since we're on this topic.
In general, when you're collecting info, passing it on to the next page (like in the case of coreg)...
If you're using aweber, is there really anything special you need to do? Won't aweber validate for you?
(of course, this is not taking into account vidivo's special need).
09-29-2011 04:01 PM
#7
clicktrack (Member)
From what i understand you can have aweber validate for you. When you pass on to aweber you can have aweber pass all of the form values back to your next page. On the next page is where you would have the code listed above to record to text file.
09-29-2011 05:44 PM
#8
vidivo (Member)

Originally Posted by
polarbacon
First question would be why do you want to do this?
is there a reason why you need to save the phone number to a file...and not to aweber?
Well with Aweber, first, you can't do much with storing phone numbers with aweber and i'd rather have a hard copy saved to myself since aweber is for emailing only, strictly speaking.
Second, aweber only allows one field cell phone submits, not 3 fields which are much easier for people to fill out. Might be a work around for it, but im not that technically savvy to try it!
Also by self validation I meant having the "OK" next to the form after you fill it out, it will probably increase conversion rates and much better quality of leads.. I got most of it figured out already by now as I ve been coding it myself and trying it out past few days
09-29-2011 05:56 PM
#9
polarbacon (Moderator)
on the 3 field thing for phone numbers.....has any one got data on this? because i would say there is about 10 other things i would do first to improve CTR of that page first.....then worry about 3 boxes....
BUT
if you wanted to do that just setup 3 dif fields in aweber.....ph1 ph2 ph3 send then all to awebber......then when you need them export to CSV at aweber....then just cut and paste them from excel when you need them....or just merge those fields in excel....
and yes aweber can validate.....they will need to hit the back button as its not live validation per se.....
09-29-2011 06:12 PM
#10
vidivo (Member)

Originally Posted by
clicktrack
This does not show aweber integration as I don't use aweber but elaborates on the code you provided to show how to collect phone number.
Code:
<?
session_start();
//Grabs Email and trims white space from front and left.
$email=trim($_REQUEST['email']);
//Grabs each section from phone number. Assuming you called the fields phone1, phone2, phone3.
$phone1 = $_REQUEST['phone1'];
$phone2 = $_REQUEST['phone2'];
$phone3 = $_REQUEST['phone3'];
//Combines the three phone numbers into one.
$phone = $phone1 . $phone2 . $phone3;
//Checks to see if email is not empty. If it is not it tries to write the email to a text file.
if($email!=""){
//Declares what file name should be
$myFile = "phones.txt";
//Tries to open the file. If it can't it dies - I would not have it die as it would stop the progress of your users.
$fh = fopen($myFile, 'a') or die("can't open file");
//Assigns what will go in file - If only email use this one.
$stringData = $email."\n";
//If you want email and phone in comma separated line then this one
$stringData = $email.",".$phone."\n";
//Writes the line in the file
fwrite($fh, $stringData);
//Closes the file
fclose($fh);
}
?>
Thanks for that! I tried it out, but still wasnt able to get it to work? I did 777 my phones.txt file, and I edited the code just a little bit to work with just phone numbers... Look below:
<?
session_start();
$phone1 = $_REQUEST['mobile_number1'];
$phone2 = $_REQUEST['mobile_number2'];
$phone3 = $_REQUEST['mobile_number3'];
$phone = $phone1 . $phone2 . $phone3;
if($phone!=""){
$myFile = "phones.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = $phone."\n";
fwrite($fh, $stringData);
fclose($fh);
}
?>
Also yes my fields are called mobile_number1 and so on and I put as a value for the fields on the cell phone this: value="<?=$phone1?>" and so on..
but it doesnt collect and not sure why..
09-29-2011 06:37 PM
#11
vidivo (Member)

Originally Posted by
polarbacon
on the 3 field thing for phone numbers.....has any one got data on this? because i would say there is about 10 other things i would do first to improve CTR of that page first.....then worry about 3 boxes....
BUT
if you wanted to do that just setup 3 dif fields in aweber.....ph1 ph2 ph3 send then all to awebber......then when you need them export to CSV at aweber....then just cut and paste them from excel when you need them....or just merge those fields in excel....
and yes aweber can validate.....they will need to hit the back button as its not live validation per se.....
Yeah thats possible too, didn't really think about it, but seems like a bit of extra steps and you might mess up when your merging them and not get them in the right order... like if you mess up one row or delete on number... then all of them below will be in the wrong order... especially with a lot of data this becomes risky..
09-30-2011 09:51 PM
#12
clicktrack (Member)
The code looks correct. What I would do is put just that code into a php file on your server. Then hit that code with a querystring. If it says can't open file on the screen then there is an issue with permissions and that is why it can't write. If the screen is blank then something else is going one and you will have to debug further. An easy way to debug it is to add lines of code to print things on your screen.
test.php?mobilenumer1=123&mobile_number2=456&mobil e_number3=7890 etc
You can do stuff like echo "HERE<BR>"; in between lines to make sure it is hitting the portion of the code. I would also add this echo $phone1."<BR>"; after you declare the phone1. That will tell you if the variable is being set correctly. Then again after $phone is set do the same thing echo $phone."<BR>";
This allows you to debug and it is a trial and error until you make sure it is all working write.
If it is working for you when you hit the page directly testing then the variables are not being set then the form data is not passing to your page correctly. If you are using cpv labs and the form hits base2.php you need to have the form user the get method and not the post method. Also note that php is case sensitive so if your form name is Mobile_number1 and you are doing $_REQUEST['mobile_number1']; it will not find anything because of the capital M.
10-02-2011 04:26 PM
#13
vidivo (Member)

Originally Posted by
clicktrack
The code looks correct. What I would do is put just that code into a php file on your server. Then hit that code with a querystring. If it says can't open file on the screen then there is an issue with permissions and that is why it can't write. If the screen is blank then something else is going one and you will have to debug further. An easy way to debug it is to add lines of code to print things on your screen.
test.php?mobilenumer1=123&mobile_number2=456&mobil e_number3=7890 etc
You can do stuff like echo "HERE<BR>"; in between lines to make sure it is hitting the portion of the code. I would also add this echo $phone1."<BR>"; after you declare the phone1. That will tell you if the variable is being set correctly. Then again after $phone is set do the same thing echo $phone."<BR>";
This allows you to debug and it is a trial and error until you make sure it is all working write.
If it is working for you when you hit the page directly testing then the variables are not being set then the form data is not passing to your page correctly. If you are using cpv labs and the form hits base2.php you need to have the form user the get method and not the post method. Also note that php is case sensitive so if your form name is Mobile_number1 and you are doing $_REQUEST['mobile_number1']; it will not find anything because of the capital M.
Seems like the code works just fine, its when I hit submit on the page itself the code doesnt get pushed out and saved on the phones.txt..
ughh might just not collect phone numbers if its this much of a hassle!
08-10-2012 06:26 PM
#14
zealous (Member)
Super bump but I just solved this as I've been dealing with this myself since yesterday...
I have this working on a web coreg path but not my mobile path so I was like 'WTF IT IS ALL THE EXACT SAME'!
BUT... It wasn't the exact same.
What seemed to do it for me was changing the "name" value of my mobile capture input to the same thing as the id.
Example...
Code:
$phone=@$_GET['CellPhone'];
I had the id value on the input set to "CellPhone" but not the name value, which doesn't entirely make sense to me since it's supposed to get by id I thought.
Ex...
Code:
<input name="CellPhone" id="CellPhone" class="textbox" maxlength="10" value="" type="text">
Regardless, I hope this helps anyone out there trying to capture lead data!
Get after it!
Home >
Paid Traffic Sources >
Email