from flask import Flask, request, redirect, render_template, session app = Flask(__name__) app.secret_key = 'your_secret_key' # Login route @app.route('/login', methods=['GET', 'POST']) def login(): if request.method == 'POST': username = request.form['username'] password = request.form['password'] # Simple login validation if username == 'admin' and password == '123': session['user'] = username return redirect('/form') else: return render_template('login.html', error="Invalid credentials, try again!") return render_template('login.html') # Form route @app.route('/form', methods=['GET', 'POST']) def form(): if 'user' not in session: return redirect('/login') if request.method == 'POST': # Process submitted form data here form_data = { "Full Name": request.form['name'], "Date of Birth": request.form['dob'], "Gender": request.form['gender'], "Phone Number": request.form['phone'], "Address": request.form['address'], "Profile Picture": request.files['profile'].filename if 'profile' in request.files else "No file uploaded" } # Print form data to console for now print(form_data) return "Form submitted successfully!" return render_template('form.html') # Run the app if __name__ == '__main__': app.run(debug=True) Login

Admin Login

{% if error %}
{{ error }}
{% endif %}