I Need Help to pass data from html to another html

I would like to fill out a form on an html page and then send the completed form to another html to check the entries there and then save them. I just don’t know how to send the data from one html to another. I ask you to help me. Thanks

question.html
here is the form
{% extends 'dependencies.html' %}

{% block content %}

<div class="jumbotron container row">
    <div class="col-md-6">
        <h1>Add Question</h1>
        <div class="card card-body">
           <form action="" method="POST" id="form">
              {% csrf_token %}
                {{form.as_p}}
                <br>
               <input type="submit" name="Submit">
           </form>

        </div>
    </div>


</div>

{% endblock %}
approve_questions.html

I wanna to get the content from question.html here

currently empty 
views.py

def questions(request):
        form = addQuestionform()
        if (request.method == 'POST'):
            form = addQuestionform(request.POST)
            if (form.is_valid()):
                form.save(commit=False)
                html = render_to_string("notification_email.html")
                send_mail('The contact form subject', 'This is the message', 'noreply@codewithstein.com', ['example@gmail.com'],
                          html_message=html)


                return redirect("login")


      
        context = {'form': form}
        return render(request, 'addQuestion.html', context)


def approve_questions(request):
    return render(request, "approve_question.html")

I’ve been trying to solve the problem for 10 hours

I’m not understanding what you’re trying to ask here.

For clarity, you don’t pass data from one html page to another.

The general flow of events is that:

  • The browser requests a page
  • The server returns a page containing a form
  • The browser submits the form with data
  • The server validates the form and saves the data to the database
  • The server redirect the browser to a different page
  • That different page can read the data from the database to render a new page. (It’s not required to read the data just saved - it could read any data.)

Now, it’s not required that you save the submitted data to the database. You could immediately use that data to render a new page, but if that page isn’t a form allowing the data to be submitted back to the server, you will not have a way of keeping the data.

Please try rephrasing your question, and providing more detail and specifics about what you’re trying to do.

1 Like

Thanks for your answer
On the question.html users have the possibility to post questions for a quiz game, but before the question is posted in the game, the question has to be checked first. That’s why the admin gets an email after a player has posted a question (that a new question has been received) and in the email is a link that leads to the approve_question.html and there should be the question posted by the user and if the question is ok the question should be saved. I hope you can help me.

Translated with DeepL Translate: The world's most accurate translator (free version)

What you would want to do in this case is either:

  • Add some type of indicator to your model to identify whether the question has been checked or not.

  • Save the submitted question in a different model and move it to its final location after it’s been approved.

But either way, you need to save the data to the database after being submitted if you want someone else to look at it later.