title: how to retrieve value from url in flask
body: <p>I have developed a web app using flask, jinja template and bootstrap. I want to retrieve the name of the user from the URL after login and show it in the dashboard. After logging in it is showing the name. But when I click the dashboard it shows 'none' because the name is getting removed from the URL. If there is any solution to it tell me. It will be very helpful. Thanks in advance. The codes are given below.</p>
  
  <p>app.py</p>
  
  <pre><code>@app.route('/login', methods=['GET', 'POST'])
  def login():
      form = LoginForm()
      name=form.name.data
  
      if form.validate_on_submit():
          user = User.query.filter_by(username=form.username.data).first()
          if user:
              if user.password == form.password.data:
                  login_user(user, remember=form.remember.data)
                  session['logged_in'] = True
                  return redirect(url_for('dashboard', name=name))
  
          return '&lt;h1&gt;Invalid username or password&lt;/h1&gt;'
          #return '&lt;h1&gt;' + form.username.data + ' ' + form.password.data + '&lt;/h1&gt;'
  
      return render_template('login.html', form=form)
  
  @app.route('/dashboard', methods=['GET', 'POST'])
  @login_required
  def dashboard():
      name=request.args.get('name')
      return render_template('dashboard.html',name=name)
  </code></pre>
  
  <p>dashboard.html</p>
  
  <pre><code>&lt;section id="home" style="background: url('../static/images/rate25.jpg');background-attachment: fixed;background-size: cover;background-repeat: no-repeat;background-position: center;"&gt;
          &lt;div class="container-fluid con" align="center"&gt;
              &lt;div class="row" align="center"&gt;
                  &lt;div class="col-sm-2"&gt;&lt;/div&gt;
                  &lt;div class="col-sm-8"&gt;
                  &lt;h1 class="h1" style="font-weight: 500;text-transform: unset;"&gt;Hi {{name}}, Welcome to Ratingspro&lt;/h1&gt;&lt;/div&gt;
                 &lt;div class="col-sm-2"&gt;&lt;/div&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;
  &lt;/section&gt;
  </code></pre>
  
  <p>After Logging in I am getting this
  <a href="https://i.stack.imgur.com/GcErc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GcErc.png" alt="dashboard"></a></p>
  
  <p>After clicking the dashboard in navbar I am getting this
  <a href="https://i.stack.imgur.com/RhsQG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RhsQG.png" alt="enter image description here"></a></p>