Form Application

Hello guys,

I hope, I can find a solution here to my question…

Well, I’m trying to create a contact form. I have a contact form with the basic form elements name, telephone…etc…etc… What I’m trying to do is, I have this contact form in ever single page lets say in A and B and C. I want to apply the form post action individually separated, for instance, when user use the contact form from the page of A, I’d like to recognize the post action that it is the contact form has been used in page A or if it is B then I’d like to have an indication that details come from B…

If you please find me a solution about this logic, that would be really grateful.

Many Thanks

Well, just use a hidden text field and set the value to “a”, “b” or “c”.
Then, in your PHP code, you just read that field.

Something like this: (Same for b and c…)

To read it, just the same as normal fields: $frompage=$_POST[‘inputpage’]; Or whatever you want…

Should work nicely… good luck…

Thank you very much for you answer firstly…

Secondly, I’m not well-educated person on PhP, however, what I understood is that you are suggesting me to include a ‘value’ item into ‘-input-’ and also connect to php post elements… My insufficient explanation wasn’t good obviously, my apologies… What I’m trying to figure out is actually creating 1 contact form and to include into every page which means I’m going to use 1 form and 1 post elements instead of creating plenty of contact forms. Is your advice also possible for what I’m try to do or was it actually the solution you were trying to explain and I(noob) couldn’t understand? :slight_smile:

Many Thanks

So, if I am correct, you are asking for this:

You have 3 contact forms A, B, C.
Each of these 3 forms are separate pages A, B, C.

Correct?

And, you want to send all three of these to the same (1) PHP file for processing.

Correct?

If both questions are correct, then you would do it as I stated before.
You would edit page A and add a hidden text field inside the like this:

You would edit page B and add a hidden text field inside the like this:

You would edit page C and add a hidden text field inside the like this:

Then, inside your PHP file you would separate the coding, as needed, like this:

<?PHP if ($_POST['inputpage']=="A") { // Do whatever you need for page A... }elseif($_POST['inputpage']=="B") { // Do whatever you need for page B... }elseif($_POST['inputpage']=="C") { // Do whatever you need for page C... } ?>

So, that is how to do this in a simple manner, if the two questions above are correct.
If not, please explain to us what you need. Hopefully, this is what you are asking about… Good luck!

Sponsor our Newsletter | Privacy Policy | Terms of Service