This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 2
embed 'Success Message' in 'template variable'
Started 14 years ago by sweetrobot | 7 posts |
-
i would like the 'success message' to display something like this:
"thank you for contacting us. a confirmation email has been sent to {element_3}"
where {element_3} prints the address the user had entered.
cheers
Posted 14 years ago # -
You can customize some machform files for this. Try to follow these steps :
1. Edit "includes/post-functions.php" file and go to line 1051 for this code :
do_query($query);
then put these code exactly bellow that line
if ($form_id == 1) { $_SESSION['page_data'] = $table_data; }
2. Edit "includes/view-functions.php" file and go to line 2229 for this code :
$form_markup = <<<EOT
and put these code above that line
if ($form_id == 1) { $form->success_message = "thank you for contacting us. a confirmation email has been sent to " . $_SESSION['page_data']['element_3'] ; }
Don't forget to change the form id with yours
MachForm Support
Posted 14 years ago # -
thanks. will try soon.
Posted 14 years ago # -
My man, I can't get it to work... This is what I have:
1. "includes/post-functions.php:
//for form with review enabled, append .tmp suffix to all uploaded files
//move file and check for invalid file
$destination_file = $input['machform_data_path'].DATA_DIR."/form_{$form_id}/files/{$element_name}-{$record_insert_id}-{$_FILES[$element_name]['name']}.tmp";
if (move_uploaded_file($_FILES[$element_name]['tmp_name'], $destination_file)) {
$filename = mysql_real_escape_string($_FILES[$element_name]['name']);
$query = "update ap_form_{$form_id}_review set $element_name='{$element_name}-{$record_insert_id}-{$filename}' where id='$record_insert_id'";
do_query($query);
if ($form_id == 1) {
$_SESSION['page_data'] = $table_data;
}
}and
2. includes/view-functions.php:
//check for specific form css, if any, use it instead
if($form->has_css){
$css_dir = DATA_DIR."/form_{$form_id}/css/";
}if($embed){
$embed_class = 'class="embed"';
}if ($form_id == 1) {
$form->success_message = "your submission has been received. a notification has also been sent to " . $_SESSION['form_data']['element_2'] ;
}
$form_markup = <<<EOTPosted 14 years ago # -
It seems you've put the code in wrong line in "post-functions.php" file. Maybe you're using previous version.
To fix this, try to search this Code :$query = "INSERT INTO ap_form_{$form_id}_review ($field_list) VALUES ($field_values);";
and you'll see the complete code like this
if(empty($form_review)){ $query = "INSERT INTO ap_form_{$form_id} ($field_list) VALUES ($field_values);"; }else{ //insert to temporary table, if form review is enabled $query = "INSERT INTO ap_form_{$form_id}_review ($field_list) VALUES ($field_values);"; } do_query($query);
then put the code bellow those complete code like this
if(empty($form_review)){ $query = "INSERT INTO ap_form_{$form_id} ($field_list) VALUES ($field_values);"; }else{ //insert to temporary table, if form review is enabled $query = "INSERT INTO ap_form_{$form_id}_review ($field_list) VALUES ($field_values);"; } do_query($query); if ($form_id == 1) { $_SESSION['page_data'] = $table_data; }
MachForm Support
Posted 14 years ago # -
Okay, gettign somewhere. Now, when the form is submitted, the following error is displayed:
INSERT INTO ap_form_1 (
element_1
,element_2
,element_4
,ip_address
,date_created
) VALUES ('Tom','tom@tom.com','test message','69.84.101.212','2010-06-20 21:38:38'); Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ap_form_1 (element_1
,element_2
,element_4
,ip_address
,`date_c' at line 1Also, should there be two '==' in this:
if ($form_id == 1)
?Any suggestions, or could I send the "post-functions.php" file to you for review? Ive uploaded the file here: http://www.mediafire.com/file/mc1iqmzzwzw/post-functions.php
Posted 14 years ago # -
Sorry, I forget to remove "backtick" character in the code, it automatically changed to "code" tag in here.
I've update those code, you can try to change the file again.
However, if you still having difficulty with this, you can send me the file to
customer.service[at]appnitro.com
I will help you there
MachForm Support
Posted 14 years ago #
Reply
You must log in to post.