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
https://forums.phpfreaks.com/topic/270082-submit-form/
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
https://forums.phpfreaks.com/topic/270082-submit-form/#findComment-1388816
Share on other sites

The form that calls that scipt has a POST method

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

 

 

The form with the GET is merely a submit button to return to the form

 

<form method="get" action="form.php">

<button type="submit">Continue</button>

</form>

Link to comment
https://forums.phpfreaks.com/topic/270082-submit-form/#findComment-1388958
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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