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
SOFARI HASSANE
NA
237
21.7k
Problem when inserting data into DB
Jul 9 2019 4:10 AM
Hi everyone!
I do not know what happened to my code, I have trouble inserting data into the database and yet I have no errors
here is my code:
<?php
include_once
(
'config.php'
);
if
(isset(
$_POST
[
'submit'
])){
$nom
=isset(
$_POST
[
'nom'
]);
$prenom
=isset(
$_POST
[
'prenom'
]);
$phone
=isset(
$_POST
[
'phone'
]);
$naissance
=isset(
$_POST
[
'naissance'
]);
$lieu
=isset(
$_POST
[
'lieu'
]);
$nationalite
=isset(
$_POST
[
'nationalite'
]);
$passport
=isset(
$_POST
[
'passport'
]);
$ckckl
[]=isset(
$_POST
[
'chkl[]'
]) ;
$tmp
=isset(
$_FILES
[
'photo'
][
'tmp_name'
]);
$img
=isset(
$_FILES
[
'photo'
][
'name'
]);
$type
=isset(
$_FILES
[
'photo'
][
'type'
]);
if
(
is_uploaded_file
(
$tmp
)) {
if
(!
strstr
(
$type
,
'jpg'
) && !
strstr
(
$type
,
'png'
)){
echo
"Ooops! veuillez choisir une image"
;
}
if
(!move_uploaded_file(
$tmp
,
"./dist/img/$img"
)) {
echo
"Désolé,destinantion non trouvée!"
;
}
$query
=
"INSERT INTO pelerin (nom,prenom,genre,dateNaissance,lieuNaissance,nationalite,numPassport,photo) VALUES ('"
.
$nom
.
"','"
.
$prenom
.
"','"
.
$genre
.
"','"
.
$phone
.
"','"
.
$naissance
.
"','"
.
$lieu
.
"','"
.
$nationalite
.
"','"
.
$passport
.
"','"
.
$img
.
"')"
;
mysqli_query(
$conn
,
$query
);
echo
"Record is inserted"
;
}
}
?>
<form role=
"form"
action=
"insert.php"
method=
"post"
>
<div
class
=
"box-body"
>
<div
class
=
"form-group"
>
<label
for
=
"exampleInputName"
>Nom</label>
<input type=
"text"
class
=
"form-control"
id=
"exampleInputName"
placeholder=
"Entrer le nom"
name=
"nom"
>
</div>
<div
class
=
"form-group"
>
<label
for
=
"exampleInputPrenom"
>Prénom</label>
<input type=
"text"
class
=
"form-control"
id=
"exampleInputPrenom"
placeholder=
"Entrer le prénom"
name=
"prenom"
>
</div>
<div
class
=
"form-group"
>
<label
for
=
"exampleInputGenre"
>Genre</label>
<label
class
=
"checkbox-inline"
>
<input type=
"checkbox"
value=
""
name=
"ckckl[]"
>M
</label>
<label
class
=
"checkbox-inline"
>
<input type=
"checkbox"
value=
""
name=
"ckckl[]"
>F
</label>
</div>
<div
class
=
"form-group"
>
<label
for
=
"exampleInputPhone"
>Téléphone</label>
<input type=
"numbre"
class
=
"form-control"
id=
"exampleInputPhone"
placeholder=
"Entrer le téléphone"
name=
"phone"
>
</div>
<div
class
=
"form-group"
>
<label
for
=
"exampleInputDate"
>
Date
de naissance</label>
<input type=
"Date"
class
=
"form-control"
id=
"exampleInputDate"
placeholder=
"Date de baissance"
name=
"naissance"
>
</div>
<div
class
=
"form-group"
>
<label
for
=
"exampleInputLieu"
>Lieu de naissance</label>
<input type=
"text"
class
=
"form-control"
id=
"exampleInputLieu"
placeholder=
"Lieu de naissance"
name=
"lieu"
>
</div>
<div
class
=
"form-group"
>
<label
for
=
"exampleInputNationalite"
>Nationalité</label>
<input type=
"text"
class
=
"form-control"
id=
"exampleInputNationalite"
placeholder=
"Entrer la nationalité"
name=
"nationalite"
>
</div>
<div
class
=
"form-group"
>
<label
for
=
"exampleInputPassport"
>Numéro Passport</label>
<input type=
"text"
class
=
"form-control"
id=
"exampleInputPassport"
placeholder=
"Entrer le numéro du passport"
name=
"passport"
>
</div>
<div
class
=
"form-group"
>
<label
for
=
"exampleInputFile"
>File input</label>
<input type=
"file"
id=
"exampleInputFile"
name=
"photo"
>
</div>
</div><!-- /.box-body -->
<div
class
=
"box-footer"
>
<button type=
"submit"
name=
"submit"
class
=
"btn btn-primary"
>Enregistrer</button>
</div>
</form>
could someone help me to see more clearly, thank you in advance!
Reply
Answers (
1
)
Make Login and Signup Form Using Only Mobile Number and OTP.
save dynamic added div in another html file through database