Jump to content

Displaying a success message dilemma.


Love2c0de
Go to solution Solved by PaulRyan,

Recommended Posts

Good evening,

 

I have a contact form which when submitted, gets processed inside my main index.php file and inserts into the database via a separate file for my query, 2 directories above this file.

 

When it's time to insert, we go into this file and after the query, check to see the affected rows.

 

At the minute, I am using a header() redirect to prevent the user being able to submit data multiple times so easily with the warning message which we get. I set a $confirmation message variable in the query script which is supposed to be displayed underneath the form but because of the header() is obviously not displaying.

 

I could always write the query script in the main index.php file but I don't think this is good for the structure and security.

 

My only options I see here are to either redirect them to a 'Message Confirmation' page, set a session variable - but I know for sure it's not good practice to do it this way, or process the form in the index.php file but again the issues mentioned above, I will not be exploring this avenue.

 

Any thoughts?

 

Kind regards,

 

L2c.

Edited by Love2c0de
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.