WebSite X5Help Center

 
Karel C.
Karel C.
User

Intercept form entries for further processing  en

Author: Karel C.
Visited 1372, Followers 2, Shared 0  

I developed a website for my bridgeclub: www.bcdenbruel.be. There is a form in a 'ik zoek partner' page ('looking for partner') where a member X can communicate he has no partner for the next club evening (his name & email). His entry is registered in an SQL table and displayed on the same page (using DBVIEWER), AND an automated PHP routine sends an email to all members (mail addresses read from another table) to tell them that "... 'somebody' is looking for a partner. " and that they should look at the 'looking for partner' page . All this works fine .

I would like to improve this by sending the message : ' X is looking for a partner'. 

Yes, I could retrieve that name X from the first table, but is there no internal variable allocated to that name I can use in my PHP routine after the POST ?

Posted on the
8 ANSWERS - 1 CORRECT
Paul M.
Paul M.
Moderator

Hello Karel,

Looking at the source code of your page, you should be able to use the following variable, directly after POST:

$_POST['imObjectForm_1_1']

Kind regards,

Paul

Read more
Posted on the from Paul M.
Karel C.
Karel C.
User
Author

Thanks Paul, will try that .

Read more
Posted on the from Karel C.
Karel C.
Karel C.
User
Author

The page with the data form is called 'looking for partner'. Upon submission it calls 'confirm.php' with this simple script:

<?php

$name = $_POST['imObjectForm_1_1'] ;

echo $name;

?>

Nothing happens: blank page. What did I miss ?

Read more
Posted on the from Karel C.
Paul M.
Paul M.
Moderator

Do you refer to this page?

http://www.bcdenbruel.be/ik-zoek-partner.html

If so then your source code shows that the data is currently being sent to imEmailForm.php as opposed to confirm.php

You will have to alter the Email Form Object settings to allow the data to be sent to your confirm.php script, as POST data must be captured and processed immediately...  it won't survive redirection to another page/script.

Alternatively you could capture the data in imEmailForm.php before calling confirm.php  -  however, if you are editing standard WebSite X5 files in this way then please always let Incomedia know that you are using custom code if you run into any issues in future.

Read more
Posted on the from Paul M.
Karel C.
Karel C.
User
Author

Yes, that is the one. 

OK thanks Paul. The Email form object has 3 tabs: list, send and style. Bottom right on the  'send' section, you can specify 'confirmation page after sending data'. I thought that is where I could specify a webpage to intercept the POST. So you're saying there still is another one in between. 

Anyway, will do some further testing. If nothing works, I can still read the table.

Thanks a lot,

Karel

Read more
Posted on the from Karel C.
Karel C.
Karel C.
User
Author

No, it is not my intention to manupilate the HTML source files generated by X5. Any custom code I inject, I do out from within X5. 

Read more
Posted on the from Karel C.
Paul M.
Paul M.
Moderator
Karel C.
Bottom right on the  'send' section, you can specify 'confirmation page after sending data'. I thought that is where I could specify a webpage to intercept the POST.

No, that's not the right setting to use, Karel  -  that particular setting is used to direct a web visitor to a specific page after submitting your form...  it doesn't direct form data to a script.

The setting you require is also on the 'Send' tab  -  under 'Data submission', select 'Send data to a file' from the dropdown menu, and point to your 'confirm.php' script in the field below (please see the screenshot attached).

Read more
Posted on the from Paul M.
Karel C.
Karel C.
User
Author

I see. So I have to choose between sending it to a DB or to a file. 

Thanks Paul.

Read more
Posted on the from Karel C.