You are on page 1of 10

AAKKAM

SESSION 9
ADVANCE OPERATION

TODAY’S QUOTES

IT IS NOT THAT
I AM SO SMART,
BUT I STAY
WITH THE QUESTIONS
MUCH LONGER

1
AAKKAM

STAFFSTUVIEW.HTML

<td><a href="{{url_for('upattendence',id=stu[0])}}">Attendence</a></td>

UPATTENDENCE.HTML

<form class="form-

contact contact_form" action="" method="post" enctype="multipart/form-


data" id="contactForm" novalidate="novalidate">
<div class="row">

<div class="col-sm-6">
<div class="form-group">
<input class="form-
control valid" name="name" value="{{stu[1]}}" type="text" placeholder="Enter
your student name">
</div>
</div>

<div class="col-sm-6">

2
AAKKAM

<div class="form-group">
<input class="form-
control valid" name="rollno" value="{{stu[2]}}" type="text" placeholder="Enter
your Rollno">
</div>
</div>

<div class="col-sm-6">
<div class="form-group">
<input class="form-
control valid" name="att" value="{{stu[10]}}" type="text" placeholder="Enter St
udent Attendence">
</div>
</div>

</div>

<div class="form-group mt-3">


<button type="submit" class="button button-contactForm boxed-
btn">Send</button>
</div>
</form>

3
AAKKAM

APP.PY

@app.route("/upattendence",methods=['POST','GET'])
def upattendence():
conn=mysql.connect()
cur=conn.cursor()
stuid=request.args.get('id')
cur.execute("SELECT * FROM `student` WHERE `id`='"+stuid+"'")
student1=cur.fetchone()
if request.method=='POST':
att=request.form['att']
conn=mysql.connect()
cur=conn.cursor()
cur.execute("UPDATE `student` SET `att`='"+att+"'WHERE `id`='"+stuid+"'
")
conn.commit()
return redirect('staffviewstu')
else:
return render_template("upattendence.html",stu=student1)

4
AAKKAM

@app.route("/studentlogin",methods=['POST','GET'])
def studentlogin():
if request.method=='POST':
rollno=request.form['rollno']
conn=mysql.connect()
cur=conn.cursor()
cur.execute("SELECT * FROM `student` WHERE `rollno`='"+rollno+"'")
data=cur.fetchone()
if data[2]==rollno:
return redirect(url_for('studenthome',id=data[0]))
else:
error='invalid'
else:
return render_template("studentlogin.html")

@app.route("/studenthome")
def studenthome():
stuid=request.args.get('id')
return render_template("studenthome.html",student=stuid)

5
AAKKAM

@app.route("/studentprofile")
def studentprofile():
conn=mysql.connect()
cur=conn.cursor()
stuid=request.args.get('id')
cur.execute("SELECT * FROM `student` WHERE `id`='"+stuid+"'")
student=cur.fetchone()
return render_template("studentprofile.html",stu=student)

STUDENTHOME.HTML

{% for data in student%}


<a href="{{url_for('studentprofile',id=data[0])}}" class="bt
n hero-btn" data-animation="fadeInLeft" data-delay="0.7s">View Profile</a>

<a href="{{url_for('studentviewatt',id=data[0])}}" class="bt


n hero-btn" data-animation="fadeInLeft" data-
delay="0.7s">View Attendence</a>

<a href="{{url_for('attendence')}}" class="btn hero-


btn" data-animation="fadeInLeft" data-delay="0.7s">Logout</a>

{% endfor %}

6
AAKKAM

STUDENTPROFILE.HTML

<html>

<head>
<style>

.bg
{
background-color: azure;
height: 100%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
/* Control the left side */

.left
{
background-color: azure;
height: 100%;
width:50%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;

7
AAKKAM

float: left;

}
.right
{
background-color:azure;
height: 100%;
width: 40%;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
float: right;

body,html{
height: 100%;
margin: 0;
}

</style>

8
AAKKAM

</head>

<body>
<div class='bg'>'
<h1 style=" margin-left: 600px">View Profile</h1>

<div class=" left" style=" margin-left: 100px" >

<img width="280" height="510" src='../static/uploads/{{stu[9]}}'>

</div>

<div class=" right" >

Student Name : <input class="form-


control valid" name="name" value="{{stu[1]}}" type="text" placeholder="Enter
your student name"><br><br>
Roll No: <input class="form-
control valid" name="rollno" value="{{stu[2]}}" type="text" placeholder="Enter
your Rollno"><br><br>
Phone Number <input class="form-
control valid" name="phno" value="{{stu[4]}}"type="text" placeholder="Enter y
our Phno"><br><br>

9
AAKKAM

Email Id <input class="form-


control valid" name="email" value="{{stu[5]}}" type="email" placeholder="Ema
il"><br><br>
Father Name <input class="form-
control valid" name="fathername" value="{{stu[6]}}" type="text" placeholder="E
nter your Father Name"><br><br>
Address <input class="form-
control" name="address" type="text" value="{{stu[7]}}" placeholder="Enter Add
ress"><br><br>
Department <input class="form-
control valid" name="dept" type="text" value="{{stu[8]}}" placeholder="Enter yo
ur Dept"><br><br>

</div>
</div>
</body>

</html>

10

You might also like