Jump to content

shashidharkulkarni

New Members
  • Posts

    1
  • Joined

  • Last visited

shashidharkulkarni's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. i am trying to put form data to mysql table what's wrong with my code below does not give any error but not inserting any data in table <html> <head> <title>HTML formS</title> </head> <body> <form action="insertform.php" method="post"> Name : <input type="text" name="name"><br> address : <input type="text" name="address"><br> topic :<input type="text" name="topic1"><br> <input type="submit" value="submit"> </form> <?php $name = $_POST['name']; $address = $_POST['address']; $topic1 = $_POST['topic1'];   if (isset($_POST['submit'])){ $con = mysql_connect("localhost","db","password"); if (!$con){ die("can not connect".mysql_error()); } mysql_select_db("db",$con); $sql= "INSERT INTO student_register_test10 (name, address, topic1) values ($name, $address, $topic1)"; mysql_query($sql,$con); if (!mysqli_query($con,$sql)) { die('Error: ' . mysqli_error($con)); } echo "Success!"; mysql_close($con); } ?> </body> </html>  
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.