From what I can see the new Version 3.0 creates the mail() function inline instead of with variables as it did before. This is OK but it makes it more difficult to modify the mail() function fields.
This site will show you alot about the mail function: http://us3.php.net/function.mail
In summary
mail ($to,$subject,$message,$header)
where $header can take the form of
$header = 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$header .= 'Cc: birthdayarchive@example.com' . "\r\n";
$header .= 'Bcc: birthdaycheck@example.com' . "\r\n";
You can set these values to anything you want.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You posted some really great information on 07-31-2007 about $additional_headers... You wrote the following code for bcc and other headers to include.
mail ($to,$subject,$message,$header)
where $header can take the form of
$header = 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$header .= 'Cc: birthdayarchive@example.com' . "\r\n";
$header .= 'Bcc: birthdaycheck@example.com' . "\r\n";
I went to the site you suggested http://us3.php.net/function.mail to learn more about the mail() function...but somehow in adding more headers, I messed up my script. Originally I wanted my data fields to be HTML to make it more clear to my client receiving the email from his client, but that got a little more than confusing... therefore I left it as straight content.... Yet I still come up with an error.
// Mail it
mail($to, $subject, $headers, $additional_headers);
include("confirm.html");
else {echo "Invalid Captcha String.";}?>
When I run it, I get this error message: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /form/processor.php on line 14..
Can you shed some light for me?
Thank you
hehafner
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First things first.
Fix the following basic errors:
1.) You have an if-else statement with improper syntax. The syntax is:
if(condition) {
set of statements;
a;
b;
etc;
}
else {
set of other statements;
x;
y;
z;
}
What you have is
if(condition)
set of statements;
a;
b;
etc;
else {
set of other statements;
x;
y;
z;
}
See the difference? Add some brackets around the entire "set of statements" after the if(condition).
2.) Your mail function uses an undefined variable $additional_headers. This field location in the mail function is where you should be putting your $message.
3.) I have never seen the error you are getting and can not find any clear definition of why this occurs. There are some suggestions to remove all the spaces in your $headers like this
$headers = 'To: Kevin <MyClient@his.domain.com>'."\r\n";
$headers .= 'From: Booking Request <MyClient@his.domain.com>'."\r\n";
$headers .= 'Bcc: blind@carboncopy.com'."\r\n";
Try these things first. If you need additional help be sure to put a link to your form in for me to use for debugging the process file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, I created two forms. One works, fine...I get my email confirmation. The other one gets no confirmation email. I saved each to a different file. Not sure what's wrong.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You haven't provided much to go by but here is what I can tell you.
THe generator creates forms in separate folders for a very good reason. The form processor.php file is unique to each form. If you mix forms into the same folder you will overwrite the processor such that one form will no longer work. If you have complete kept both forms separated there is no reason for each form not to work.
If you can not figure it out you will have to tell me more about the forms and how they are installed or you will have to give me pointers to the forms you created so can see them for myself.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Very Nice. This will help at least a few of my clients.
I chose the dtabase + email option for my test form.
First I had an issue I had with one shared hosting account, where I got the error message after install, "Table created. Could not write to file". I'm not sure what happened here, but I can get you details of the server if you'd like...
I then re-entered the different database info at a different shared hosting account with a different database and the install went smoothly. I attempted to fool the form by a) not filling in required fields, and b) not entering CAPTCHA. Error messages came up, as expected. When I entered the form data correctly, all worked well. Data into database OK and email sent to owner OK.
I'd like to suggest a few other features, if I may (hehe) ...
1) A confirmation email to the form user after successful SUBMIT
2) Creation of a thankyou page (optional) that posts the form data and a message
3) Integration with autoresponder service, such as aweber
4) an added attribute in the DATE variable that could limit dates chosen to x days in advance, i.e. User can book reservations 48 hours in advance, but not sooner than that... if it's Wednesday, the form would reject/not allow reservations for Thursday or Friday
5) A counter that could limit the number of reservations for an event to a certain x number, then not allow anymore reservations for that date/time event
I know, I know, these are very specific requests, but they would be nice, don't you think?
BLATENT REQUEST: If you can build this for me, I'm interested in a quote...
All in all - Most excellent!!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First I can not take any credit for the creation of this tool. I do agree with your comment though, the tool is very nice.
As for your requests, you are right and there is little chance your requests will be implemented. The reason is that there are hundreds of request such as yours that are very specific to the site or person making the request. If every request was implemented it would make the tool near impossible for people to use (100's of choices for every combination of fields a user would choose).
Now as far as getting what you want, numbers 1,2,4,and 5 are simple enough. Number 3 however is a little more involved. Since I don't have much experience with aweber I can not tell you if the integration is possible or practical. What I do know is that most autoresponders have their own confirmation pages. Having your own with an additional auto responder confirmation may not be what you really want.
If you still want some help implementing the features you suggested then send me an email and I'll see if I can get you started.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In one of my forms I have a field with check boxes so users can choose multiple options. I'm just not sure how to read the results that are emailed. I get something like this:
n,o,., ,1,,,,,,,,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately at the moment these check box fields are only displayed as comma separated values. You can modify the processor.php file to display the data in a format that is more suitable to you.
The last person I helped with this issue also had field names mixed up which made it even more confusing.
Try this:
First make a backup copy of your processor.php file.
Edit the file using the following instructions.
In the mail() function the whole message is defined "in-line".
Just above this line define a variable like this
$myformmessage="";
copy the whole message section of the mail() function and insert it in between the quotes of the $myformmessage variable. Right after the $myformmessage variable put these additional lines
echo "$myformmessage";
exit;
Now go back to your form, fill in some test data and submit the form. What you will see is the format of the message you would see in your email. Now you can play with the message format until you are satisfied with the result. When you are done justr reverse the process by doing the following.
remove the lines
echo "$myformmessage";
exit;
copy the new value of the $myformmessage variable and paste it into the mail() function you copied it from.
If you screw it up just replace the processor.php with your backup copy and come back for more help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm posting here so that your expertise can be shared with the community. ;)
SARmedic wrote (above):
I like to get IP and date information when a form is submitted,
either I missed that or it isn't there. I had to add that to my
processor.php file manually as such:
Submitted............: " . date("l, F j, Y") . "
Ip Address...........: " . $_SERVER['REMOTE_ADDR'] . "
Additional on IP.....: " . gethostbyaddr($ip) . "
I used the Hidden variables in the demo site, but obviously input the variables in a way that were not parsed correctly. For example, I entered: REMOTE_HOST as a value, but the database just gets REMOTE_HOST as the value, not the actual Host info.
I'd also like to captute the Date and Time of the form submission, so I used datetime=NOW as the value, but again, the database just shows the string: datetime=NOW
In the past I have set up forms like this:
in the form itself, I'd add:
#1
The variable must exist (valid PHP variables) before they can be obtained.
Take a look: http://us.php.net/reserved.variables
Not all variables are available all the time.
#2
If a form is expected to get the variables then the form must execute php code. To do this the form must be a form.php file instead of a form.html file. Otherwise you don't need hidden form input fields. You can just add them to the processor.php file and do whatever you want with them.
#3
Adding the following line to a form.html file
<input type=hidden name=field_5 id=field_5 value="REMOTE_HOST">
will only pass a variable to the processor.php file like this
$_POST['field_5']
and the value has already been set by the form.html file with this part of the input field
value="REMOTE_HOST"
So unless you change it in the processor.php the value you store is always "REMOTE_HOST".
$query = "INSERT into `".$db_table."` (field_5) VALUES ('" . $_POST['field_5'] . "')";
#4
Solution:
Forget additions to the form.html file and add something like the following to the processor.php file.
//set the remote host value
$rhost = $_SERVER['REMOTE_HOST'];
//store the value in your SQL database
$query = "INSERT into `".$db_table."` (field_5) VALUES ('" . $rhost . "')";
//mail the value in your message
mail("youremail@yourdomain.com","phpFormGenerator - Form submission","Form data:
REMOTE HOST: " . $rhost . "
powered by phpFormGenerator.
");
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
To anyone concerned, I have figured out how to get the hidden variables that I wanted into my database and emails. If you are interested, feel free to contact me and I will share what I have done.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
VERY nice work. I have used you script and it works great. There are a few small problems but nothing version 3.01 can't fix. When do you think we are going to see the source code download available. I would like to see it and install it on my own server.
Thanks and again VERY nice work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello :
Thanks alot for this service, it helped me alot, but the problem is it didn't work for me, I can't receive any email after filling the form, to check by yourself he is the link where i put it : http://agadirvoya.1111mb.com/form.html the web site offer PHP so it is enable, i can't understand what is the problem knowing that i'm using Gmail as email.
Please help me
Thank you so much.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Lots of people seem to be having issues with this using 3.0. Try creating a very simple php file with only a simple email function.
I coul d help more by testing your form if you wish. Send me the link to your zip file or email it to me and I'll let you know how if works on my site.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi inteveret1, what's up, thank you for this reply, you can access the package through the link : http://www.phpformgen.com/page_home.php?form_id=8815 download it and test it by yourself, don't forget to change the email into yours in order to let you know if you received mails or not of course you know that :)
good luck
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i am trying to create a multiple page form
how can i add a back button so user can go back to check every page before the form submit
this feature can be very useful
Thanks for any advice
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Me to (test on local host)
i can't use hebrew charcters
if i will have the package i will be able to allow hebrew char and start to creat my form
so far formgen3 works great form me
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
is there any way of avoiding the 'click to continue' page once people have entered their details ?.....i'd prefer users to be directed to the confirmation/thanks page directly
w
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I have one question for you. is there a way to set a form to E-mail from a specific address?
For example: From:Jadadea@website.com instead of: accountName@servername.biz
Thanks and keep up the good work,
Jadadea
From what I can see the new Version 3.0 creates the mail() function inline instead of with variables as it did before. This is OK but it makes it more difficult to modify the mail() function fields.
This site will show you alot about the mail function:
http://us3.php.net/function.mail
In summary
mail ($to,$subject,$message,$header)
where $header can take the form of
$header = 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$header .= 'Cc: birthdayarchive@example.com' . "\r\n";
$header .= 'Bcc: birthdaycheck@example.com' . "\r\n";
You can set these values to anything you want.
TNTEverett,
Thank you for the help. I shall try it and post results.
Jadadea
TNTEverett:
You posted some really great information on 07-31-2007 about $additional_headers... You wrote the following code for bcc and other headers to include.
mail ($to,$subject,$message,$header)
where $header can take the form of
$header = 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
$header .= 'Cc: birthdayarchive@example.com' . "\r\n";
$header .= 'Bcc: birthdaycheck@example.com' . "\r\n";
I went to the site you suggested http://us3.php.net/function.mail to learn more about the mail() function...but somehow in adding more headers, I messed up my script. Originally I wanted my data fields to be HTML to make it more clear to my client receiving the email from his client, but that got a little more than confusing... therefore I left it as straight content.... Yet I still come up with an error.
Here is my script:
<?php
$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));
session_start();
if( ($_SESSION['security_code']==$_POST['security_code']) && (!empty($_POST['security_code'])) )
// recipient
$to = 'Kevin <MyClient@his.domain.com>';
// subject
$subject = 'Booking Request';
// Additional headers
$headers = 'To: Kevin <MyClient@his.domain.com>' . "\r\n";
$headers .= 'From: Booking Request <MyClient@his.domain.com>' . "\r\n";
$headers .= 'Bcc: blind@carboncopy.com' . "\r\n";
$message = "
Contact Name: . $_POST['field_2'] . \n .
Organization: . $_POST['field_3'] . \n .
Title/Position: . $_POST['field_4'] . \n .
Address: . $_POST['field_5'] . \n .
City: . $_POST['field_6'] . \n .
State: . $_POST['field_7'] . \n .
Zip Code: . $_POST['field_8'] . \n .
Day Phone: . $_POST['field_9'] . \n .
Evening Phone: . $_POST['field_10'] . \n .
Fax: . $_POST['field_11'] . \n .
Email Address: . $_POST['field_12'] . \n .
Website: . $_POST['field_13'] . \n .
Booking Date: . $_POST['field_14'] . \n .
Booking Time: . $_POST['field_15'] . \n .
Audience Size: . $_POST['field_16'] . \n .
Age Range: . $_POST['field_17'] . \n .
Program Type: . $_POST['field_18'] . \n .
Program(s) Interested In: . $_POST['field_19'] . \n .
Describe Event: . $_POST['field_20']. \n .
Additional Information: . $_POST['field_21'] ;";
// Mail it
mail($to, $subject, $headers, $additional_headers);
include("confirm.html");
else {echo "Invalid Captcha String.";}?>
When I run it, I get this error message: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /form/processor.php on line 14..
Can you shed some light for me?
Thank you
hehafner
First things first.
Fix the following basic errors:
1.) You have an if-else statement with improper syntax. The syntax is:
if(condition) {
set of statements;
a;
b;
etc;
}
else {
set of other statements;
x;
y;
z;
}
What you have is
if(condition)
set of statements;
a;
b;
etc;
else {
set of other statements;
x;
y;
z;
}
See the difference? Add some brackets around the entire "set of statements" after the if(condition).
2.) Your mail function uses an undefined variable $additional_headers. This field location in the mail function is where you should be putting your $message.
3.) I have never seen the error you are getting and can not find any clear definition of why this occurs. There are some suggestions to remove all the spaces in your $headers like this
$headers = 'To: Kevin <MyClient@his.domain.com>'."\r\n";
$headers .= 'From: Booking Request <MyClient@his.domain.com>'."\r\n";
$headers .= 'Bcc: blind@carboncopy.com'."\r\n";
Try these things first. If you need additional help be sure to put a link to your form in for me to use for debugging the process file.
Hello, I created two forms. One works, fine...I get my email confirmation. The other one gets no confirmation email. I saved each to a different file. Not sure what's wrong.
You haven't provided much to go by but here is what I can tell you.
THe generator creates forms in separate folders for a very good reason. The form processor.php file is unique to each form. If you mix forms into the same folder you will overwrite the processor such that one form will no longer work. If you have complete kept both forms separated there is no reason for each form not to work.
If you can not figure it out you will have to tell me more about the forms and how they are installed or you will have to give me pointers to the forms you created so can see them for myself.
Never mind...I must have forgotten to update the email info. It's working now. Thanks.
TNTEverett,
Very Nice. This will help at least a few of my clients.
I chose the dtabase + email option for my test form.
First I had an issue I had with one shared hosting account, where I got the error message after install, "Table created. Could not write to file". I'm not sure what happened here, but I can get you details of the server if you'd like...
I then re-entered the different database info at a different shared hosting account with a different database and the install went smoothly. I attempted to fool the form by a) not filling in required fields, and b) not entering CAPTCHA. Error messages came up, as expected. When I entered the form data correctly, all worked well. Data into database OK and email sent to owner OK.
I'd like to suggest a few other features, if I may (hehe) ...
1) A confirmation email to the form user after successful SUBMIT
2) Creation of a thankyou page (optional) that posts the form data and a message
3) Integration with autoresponder service, such as aweber
4) an added attribute in the DATE variable that could limit dates chosen to x days in advance, i.e. User can book reservations 48 hours in advance, but not sooner than that... if it's Wednesday, the form would reject/not allow reservations for Thursday or Friday
5) A counter that could limit the number of reservations for an event to a certain x number, then not allow anymore reservations for that date/time event
I know, I know, these are very specific requests, but they would be nice, don't you think?
BLATENT REQUEST: If you can build this for me, I'm interested in a quote...
All in all - Most excellent!!
First I can not take any credit for the creation of this tool. I do agree with your comment though, the tool is very nice.
As for your requests, you are right and there is little chance your requests will be implemented. The reason is that there are hundreds of request such as yours that are very specific to the site or person making the request. If every request was implemented it would make the tool near impossible for people to use (100's of choices for every combination of fields a user would choose).
Now as far as getting what you want, numbers 1,2,4,and 5 are simple enough. Number 3 however is a little more involved. Since I don't have much experience with aweber I can not tell you if the integration is possible or practical. What I do know is that most autoresponders have their own confirmation pages. Having your own with an additional auto responder confirmation may not be what you really want.
If you still want some help implementing the features you suggested then send me an email and I'll see if I can get you started.
Oh, I forgot to mention this:
In IE7,
the Form Description edit button doesn't work for me
and Required fields only work if I go back into the field (edit) and then click on Yes
in Firefox, all works well
- also forget 3) in my last post (re: aweber integration)...
my mind was running faster than my fingers
completely unnecessary
In one of my forms I have a field with check boxes so users can choose multiple options. I'm just not sure how to read the results that are emailed. I get something like this:
n,o,., ,1,,,,,,,,
Unfortunately at the moment these check box fields are only displayed as comma separated values. You can modify the processor.php file to display the data in a format that is more suitable to you.
The last person I helped with this issue also had field names mixed up which made it even more confusing.
Try this:
First make a backup copy of your processor.php file.
Edit the file using the following instructions.
In the mail() function the whole message is defined "in-line".
Just above this line define a variable like this
$myformmessage="";
copy the whole message section of the mail() function and insert it in between the quotes of the $myformmessage variable. Right after the $myformmessage variable put these additional lines
echo "$myformmessage";
exit;
Now go back to your form, fill in some test data and submit the form. What you will see is the format of the message you would see in your email. Now you can play with the message format until you are satisfied with the result. When you are done justr reverse the process by doing the following.
remove the lines
echo "$myformmessage";
exit;
copy the new value of the $myformmessage variable and paste it into the mail() function you copied it from.
If you screw it up just replace the processor.php with your backup copy and come back for more help.
Hello again,
I'm posting here so that your expertise can be shared with the community. ;)
SARmedic wrote (above):
I like to get IP and date information when a form is submitted,
either I missed that or it isn't there. I had to add that to my
processor.php file manually as such:
Submitted............: " . date("l, F j, Y") . "
Ip Address...........: " . $_SERVER['REMOTE_ADDR'] . "
Additional on IP.....: " . gethostbyaddr($ip) . "
I used the Hidden variables in the demo site, but obviously input the variables in a way that were not parsed correctly. For example, I entered: REMOTE_HOST as a value, but the database just gets REMOTE_HOST as the value, not the actual Host info.
I'd also like to captute the Date and Time of the form submission, so I used datetime=NOW as the value, but again, the database just shows the string: datetime=NOW
In the past I have set up forms like this:
in the form itself, I'd add:
<input type="hidden" name="env_report" value="REMOTE_HOST,REMOTE_ADDR,REMOTE_USER,HTTP_USER_AGENT">
then below I'd have something like:
if (isset($_POST['getfreereport'])) {
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$phone = $_POST['phone'];
$email = $_POST['email'];
$datetime = $_POST['datetime'];
$sql = "INSERT INTO table_name SET
fname='$fname',
lname='$lname',
phone='$phone',
email='$email',
REMOTE_HOST='$REMOTE_HOST',
REMOTE_ADDR='$REMOTE_ADDR',
REMOTE_USER='$REMOTE_USER',
HTTP_USER_AGENT='$HTTP_USER_AGENT',
datetime=NOW()";
So, the question is, How can I use the Hidden variables to set these up in phpFormGen 3.0?
Thanks in advance!
gemnut
#1
The variable must exist (valid PHP variables) before they can be obtained.
Take a look:
http://us.php.net/reserved.variables
Not all variables are available all the time.
#2
If a form is expected to get the variables then the form must execute php code. To do this the form must be a form.php file instead of a form.html file. Otherwise you don't need hidden form input fields. You can just add them to the processor.php file and do whatever you want with them.
#3
Adding the following line to a form.html file
<input type=hidden name=field_5 id=field_5 value="REMOTE_HOST">
will only pass a variable to the processor.php file like this
$_POST['field_5']
and the value has already been set by the form.html file with this part of the input field
value="REMOTE_HOST"
So unless you change it in the processor.php the value you store is always "REMOTE_HOST".
$query = "INSERT into `".$db_table."` (field_5) VALUES ('" . $_POST['field_5'] . "')";
#4
Solution:
Forget additions to the form.html file and add something like the following to the processor.php file.
//set the remote host value
$rhost = $_SERVER['REMOTE_HOST'];
//store the value in your SQL database
$query = "INSERT into `".$db_table."` (field_5) VALUES ('" . $rhost . "')";
//mail the value in your message
mail("youremail@yourdomain.com","phpFormGenerator - Form submission","Form data:
REMOTE HOST: " . $rhost . "
powered by phpFormGenerator.
");
To anyone concerned, I have figured out how to get the hidden variables that I wanted into my database and emails. If you are interested, feel free to contact me and I will share what I have done.
VERY nice work. I have used you script and it works great. There are a few small problems but nothing version 3.01 can't fix. When do you think we are going to see the source code download available. I would like to see it and install it on my own server.
Thanks and again VERY nice work.
Hello :
Thanks alot for this service, it helped me alot, but the problem is it didn't work for me, I can't receive any email after filling the form, to check by yourself he is the link where i put it : http://agadirvoya.1111mb.com/form.html the web site offer PHP so it is enable, i can't understand what is the problem knowing that i'm using Gmail as email.
Please help me
Thank you so much.
Lots of people seem to be having issues with this using 3.0. Try creating a very simple php file with only a simple email function.
I coul d help more by testing your form if you wish. Send me the link to your zip file or email it to me and I'll let you know how if works on my site.
Hi inteveret1, what's up, thank you for this reply, you can access the package through the link : http://www.phpformgen.com/page_home.php?form_id=8815 download it and test it by yourself, don't forget to change the email into yours in order to let you know if you received mails or not of course you know that :)
good luck
The email is received OK on my site.
Hi
i am trying to create a multiple page form
how can i add a back button so user can go back to check every page before the form submit
this feature can be very useful
Thanks for any advice
I want to test them on the localhost.
Can i have the installation files please!!
Me to (test on local host)
i can't use hebrew charcters
if i will have the package i will be able to allow hebrew char and start to creat my form
so far formgen3 works great form me
is there any way of avoiding the 'click to continue' page once people have entered their details ?.....i'd prefer users to be directed to the confirmation/thanks page directly
w