TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
NURU DAWUD
1.4k
349
16.5k
Submit button does nothing?
May 4 2021 10:04 PM
php part(registration.php)
<?php
session_start();
include
(
"db_conn.php"
);
if
(isset(
$_POST
[
'submit'
])){
function
validate(
$data
){
$data
= trim(
$data
);
$data
=
stripslashes
(
$data
);
$data
= htmlspecialchars(
$data
);
return
$data
;
}
$fatherName
= validate(
$_POST
[
'fatherName'
]);
$firstName
= validate(
$_POST
[
'firstName'
]);
$grandFatherName
= validate(
$_POST
[
'grandFatherName'
]);
$gender
= validate(
$_POST
[
'gender'
]);
$nationality
= validate(
$_POST
[
'nationality'
]);
$residence
= validate(
$_POST
[
'residence'
]);
$country
= validate(
$_POST
[
'country'
]);
$regionOrState
= validate(
$_POST
[
'regionOrState'
]);
$city
= validate(
$_POST
[
'city'
]);
$email
= validate(
$_POST
[
'email'
]);
$phone
= validate(
$_POST
[
'phone'
]);
$department
= validate(
$_POST
[
'department'
]);
$graYear
= validate(
$_POST
[
'year'
]);
$studyLevel
= validate(
$_POST
[
'studyLevel'
]);
$ocopation
= validate(
$_POST
[
'ocopation'
]);
$comment
= validate(
$_POST
[
'comment'
]);
$sql2
= "INSERT INTO mebmbertable(
fatherName, firstName, grandFatherName, gender, nationality, residence, country, regionOrState, city, email, phone, department, graYear, studyLevel, ocopation, comment )
VALUES
(
'$fatherName'
,
'$firstName'
,
'$grandFatherName'
,
'$gender'
,
'$nationality'
,
'$residence'
,
'$country'
,
'$regionOrState'
,
'$city'
,
'$email'
,
'$phone'
,
'$department'
,
'$graYear'
,
'$studyLevel'
,
'$ocopation'
,
'$comment'
)";
if
(!mysqli_query(
$conn
,
$sql2
)) {
echo
" Your account has been created successfully. Please login... "
;
}
else
{
header(
"error=unknown error occurred"
);
}
}
?>
HTML PART(registrationForm.php)
<?php
session_start();
include
(
"db_conn.php"
);
?>
<!DOCTYPE html>
<!-- Designined by CodingLab - youtube.com/codinglabyt -->
<html lang=
"en"
dir=
"ltr"
>
<head>
<meta charset=
"UTF-8"
>
<title> Membership Registration </title>
<link rel=
"stylesheet"
href=
"style1.css"
>
<link rel=
"stylesheet"
href=
"style.css"
>
<script src=
"alert.js"
></script>
<meta name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
</head>
<body>
<div
class
=
"container"
>
<center>
<h1
class
=
"h"
> X University Registrar
and
Alumni Directorate </h1>
<h2
class
=
"h"
>Membership Application Form</h2>
<h3
class
=
"h"
>Membership is open to all graduates of Wollo University
</center>
<div
class
=
"content"
>
<form action=
"registration.php"
method=
"POST"
>
<div
class
=
"title"
>1) Personal Information </div>
<div
class
=
"user-details"
>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Father Name</span>
<input type=
"text"
name=
"fatherName"
placeholder=
"Father Name"
required >
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Name</span>
<input type=
"text"
name=
"firstName"
placeholder=
"Name"
required>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Grand Father Name</span>
<input type=
"text"
name=
"grandFatherName"
placeholder=
"Grand Father Name"
required>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Nationality</span>
<input type=
"text"
name=
"nationality"
placeholder=
"Nationality"
required>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Residence</span>
<input type=
"text"
name=
"residence"
placeholder=
"Residence"
required>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Country</span>
<input type=
"text"
name=
"country"
placeholder=
"Country"
required>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Region/State</span>
<input type=
"text"
name=
"regionOrState"
placeholder=
"Region/State"
required>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>City</span>
<input type=
"text"
name=
"city"
placeholder=
"City"
required>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Email</span>
<input type=
"email"
name=
"email"
placeholder=
"Email"
required>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Phone</span>
<input type=
"tel"
name=
"phone"
placeholder=
"Phone"
required>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Gender</span>
<select name=
"gender"
id=
"gender"
class
=
"select"
>
<option value=
""
>...</option>
<option value=
"Male"
>Male</option>
<option value=
"Female"
>Female</option>
</select>
</div>
</div>
<div
class
=
"title"
>2) Education </div>
<div
class
=
"user-details"
>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Department</span>
<input type=
"text"
name=
"department"
placeholder=
"Department"
required>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Year of Gratuation</span>
<input type=
"year"
name=
"year"
placeholder=
"Year of Gratuation"
required>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Study Level</span>
<select name=
"studyLevel"
id=
"sl"
class
=
"select"
>
<option value=
""
>...</option>
<option value=
"Diploma"
>Diploma</option>
<option value=
"Advanced Deploma"
>Advanced Deploma</option>
<option value=
"BA/BSC"
>BA</option>
<option value=
"BA/BSC"
>BSC</option>
<option value=
"MA/MSC"
>MA</option>
<option value=
"BA/BSC"
>MSC</option>
<option value=
"PhD"
>PhD</option>
<option value=
"Speciality"
>Speciality</option>
<option value=
"Sub-Speciality"
>Sub-Speciality</option>
</select>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Ocopation</span>
<select name=
"ocopation"
id=
"sl"
class
=
"select"
>
<option value=
""
>...</option>
<option value=
"Gevernment"
>Gevernment</option>
<option value=
"Private"
>Private</option>
<option value=
"NGO"
>NGO</option>
<option value=
"Job Seeker"
>Job Seeker</option>
<option value=
"Other"
>Other</option>
</select>
</div>
<div
class
=
"input-box"
>
<span
class
=
"details"
>Comment</span>
<textarea
class
=
"textarea"
name=
"comment"
placeholder=
" Enter your comment here..."
></textarea>
</div>
<div
class
=
"input-box"
>
<br><br>
<img src=
"img/Membership.gif"
width=
"70%"
height=
"50%"
align=
"right"
alt=
"Membership"
>
</div>
</div>
<div
class
=
"button"
>
<button type=
"submit"
value=
"Save"
> Save</button>
</div>
<div
class
=
"button"
>
<input type=
"reset"
value=
"Reset"
>
</div>
<div>
<h1
class
=
"a"
><a href=
"logout.php"
>Logout</a></h1>
</div>
</form>
<div
class
=
"thankyou"
>
<center> <h3>Hello, <?php
echo
$_SESSION
[
'name'
]; ?></h3>
<p
class
=
"p"
>Thank you
for
filling this form<br>
X University Registrar
and
Alumni Directorate
</p> </center>
</div>
</div>
</div>
</body>
</html>
Reply
Answers (
1
)
How to install xdebug on xamp in mac
Doesnt save into my PHP