title: How can I make a html popup from flask?
body: <p>I am creating a web application and am using flask on python along with it, I have created a registration system where the user can sign to the website and their details (email, username and password) which are saved in a sqlite3 database. I have made it so if the user enters a username or email, when registering, and that username or email is in the database it takes you back to the sign in page and does not save their data, <strong>How can I make it so when it redirects you back to the form page a popup occurs with an error message?</strong>   </p>
  
  <p>Html code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html class='signIn'&gt;
  {% extends "layout.html" %}
  {% block content %}
  
  &lt;body&gt;
  
  &lt;center&gt;
  &lt;form name='myForm' method="post" action="{{ url_for('signup') }}" style='text-align: center;'&gt;
    &lt;p&gt;Email&lt;/p&gt;
    &lt;input type="email" name="email" placeholder='Enter you email adress' required oninvalid="setCustomValidity('Please enter a valid email ')" onchange="try{setCustomValidity('')}catch(e){}"&gt;&lt;/input&gt;
    &lt;p&gt;Username&lt;/p&gt;
    &lt;input type="text" name="user" placeholder='Enter your username' required&gt;&lt;/input&gt;
    &lt;p&gt;Password&lt;/p&gt;
    &lt;input type="password" name="password" placeholder='Enter your password' required&gt;&lt;/input&gt;
    &lt;br&gt;&lt;br&gt;
    &lt;input type="submit" value="Signup"&gt;&lt;/input&gt;
     &lt;a href="{{ url_for('home') }}" class='button_link'&gt;Cancel&lt;/a&gt;
  &lt;/form&gt;
  &lt;/center&gt;
  
  &lt;/body&gt;
  {% endblock %}
  &lt;/html&gt;
  </code></pre>
  
  <p>Relevant python code:</p>
  
  <pre><code>def signup():
      cur = g.db.cursor()
      email = request.form['email']
      username = request.form['user']
      password = request.form['password']
      cur.execute("""SELECT email,username FROM users WHERE email=? OR username=?""",(email, username))
      result = cur.fetchone()
      if result:
  
          return redirect('/form/')
  
      else:
          cur.execute("INSERT INTO users VALUES (?, ?, ?)", [email, username, password])
          g.db.commit()
          return redirect('/')
  </code></pre>