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>