Jump to content

Submit Form


hahaitwork

Recommended Posts

Any idea what could be wrong ? I do not get any errors but also, nothing in my database.

Will answer tomorrow morning if anyone have answered

-Thanks



<html>
<head>
<title>update database</title>
</head>

<body>
<form method="post" action="insertken.php">

ID: <input type="text" name="id" size="50" /> <br />

Name: <input type="text" name="name" size="50" /> <br />

Last Name  <input type="text" name="description" size="50" /> <br />

price <input type="text" name="price" size="50" /> <br />

sla <input type="text" name="sla" size="50" /> <br />

quantity <input type="text" name="quantity" size="50" /> <br />

fix <input type="text" name="fix" size="50" /> <br />

<input type="submit" value="Update" />


</form>
</body>
</html>

 

 

 

<?php
$id = $_POST['id'];
$name = $_POST['name'];
$description = $_POST['description'];
$price = $_POST['price'];
$sla = $_POST['sla'];
$quantity = $_POST['quantity'];
$fix = $_POST['fix'];
mysql_connect("localhost:3306","root","") or die ('ERROR: ' . mysql_error());
mysql_select_db ("my_db");
$query="INSERT INTO products (id, name, description, price, sla, quantity, fix) VALUES ('".$id."','".$name."','".$description."','".$price."','".$sla."','".$quantity."','".$fix."')";
?>
<form method="get" action="form.php">
   <button type="submit">Continue</button>
</form>

Link to comment
Share on other sites

You need to execute the query against your database using the mysql_query($query). You are not doing anything in your code and that is why your information is not getting inserted in the database. One more thing, the form method should be "post" instead of "get"

Edited by OOP
Link to comment
Share on other sites

You need to execute the query against your database using the mysql_query($query). You are not doing anything in your code and that is why your information is not getting inserted in the database. One more thing, the form method should be "post" instead of "get"

 

Sounds like I followed a pretty good tutorial >.<

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.