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
Israel
696
1.3k
217.1k
Doesnt save into my PHP
May 9 2021 3:04 PM
Hi,
I do create normally a table into my database and wrote codes to save in. Curiously when I cliick to save datas its looks like datas have been saved. But when I see into my database nothing appear. My table still blank. Other thing very strange is when I delete its works. Just not for saving.
Please see my codes:
<?php
$link
=mysqli_connect(
"localhost:3307"
,
"root"
,
""
);
mysqli_select_db(
$link
,
"rhumanos"
);
?>
<html>
<title>Untitled Document</title>
<body>
<form name=
"form1"
action=
""
method=
"post"
>
<table>
<tr>
<td>Enter Name</td>
<td><input type=
"text"
name=
"name"
></td>
</tr>
<tr>
<td>Enter City</td>
<td><input type=
"text"
name=
"city"
></td>
</tr>
<tr>
<td colspan=
"2"
align=
"center"
><input type=
"submit"
name=
"submit1"
value=
"insert"
>
<input type=
"submit"
name=
"submit2"
value=
"delete"
>
</td>
</tr>
</table>
</form>
<?php
if
(isset(
$_POST
[
"submit1"
]))
{
mysqli_query(
$link
,
"insert into name_city values('$_POST[name]','$_POST[city]')"
);
}
if
(isset(
$_POST
[
"submit2"
]))
{
mysqli_query(
$link
,
"delete from name_city where name='$_POST[name]'"
);
}
?>
</body>
</html>
Reply
Answers (
1
)
Submit button does nothing?
Php modal pop up