Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6970667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:44:21+00:00 2026-05-27T16:44:21+00:00

I am junior PHP dev and I am currently working on making a quote

  • 0

I am junior PHP dev and I am currently working on making a quote form which will take customer details and whatever the employee enters in the quote form and will:

  • Save customer and quote detail to DB.
  • Generate a PDF (using mpdf library)
  • Email the pdf to the customer

Currently its just two files index.php and quote.php

Here is a diagram

https://i.stack.imgur.com/VaQJw.png

As you can see it is a monolithic architecture (I have all the operation in one PHP file).

This is causing problems as when the user hits “SUBMIT” and quote.php does all its functions , the user is stuck on that page. Then if they hit Refresh , quote.php will be re-executed again and it ends up spamming my database tables, and email inbox.

I was wondering what is the best way to prevent the user from re-executing or going back to doing stuff which should only be done once.

I had a couple of ideas and was hoping you could suggest me yours?

  • Idea 1: A session variable that prevents re-execution of the same code.

  • Idea 2: Break up the quote.php file into seperate files and jump from each one. (is this possible)?

I want to do this the best way possible and I am open to any suggestions!

Thankyou for your time!

🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T16:44:22+00:00Added an answer on May 27, 2026 at 4:44 pm

    If the form takes a while to process (PDF generation can take time) then a good first step would be to stop the user from re-submitting the form. Use javascript to disable the submit button and maybe show a loading icon so they know something is happening.

    Once the code has finished executing you will want to redirect them to another page so that you don’t have the problem of them refreshing the page.

    This is quite simple, just send a header…

    // do PDF and email code
    // now redirect user to thank you page
    header("Location: thank_you.php");
    exit();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently creating a quote system which works like this: User submits data
I have pretty good skills in PHP , Mysql and Javascript for a junior
I am working on a few PHP projects that use MVC frameworks, and while
I'm building a web control that will let our junior IT staff manage firmware
I'm a junior developer and recently started working for a very small office where
As a PHP junior encountering Flex for the first time this scratches my brain
Oh, hi. I'm a junior java developer working in my free time on some
Is there a way of implementing a rule in mysql which will block updates
As I continue to try and improve myself as a junior PHP developer, I
I am a junior software engineer who've been given a task to take over

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.