Jump to content

Displaying a success message dilemma.


Love2c0de

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.

Link to comment
https://forums.phpfreaks.com/topic/282260-displaying-a-success-message-dilemma/
Share on other sites

Good evening PaulRyan,

 

Did exactly that and works how I wanted it to.

 

I was under the impression though that you shouldn't store trivial data in a session or is that completely untrue?

 

Kind regards,

 

L2c.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.